If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I'm making a website that contains CSS that only works in Firefox 3.5+ and Safari 4+

I would like to redirect people to my home.htm if they have either FF 3.5+ or Safari 4+.

If they have any other kind of browser or version, I would like them redirected to sorry.htm

You are going about this all wrong. Javascript and redirecting is NOT the correct solution here, the solution is to fix the css (without javascript!) to work in IE as well as FF & Safari. Believe it or not, it can be done relatively easily and is not really as hard as the javascript solution.

If your really want to keep out certain browsers it would be best to do it server side... javascript can be turned off. I redirect cellphones / handhelds to special pages that way. But of course if you want everybody to see your pages, then astupidname is right... FIX the css.

Thanks for the quick replies. I want everyone to have a chance to see my site, but I would like them to know them to know that some CSS is not supported by other browsers than Firefox and safari. This is in sorry.htm, along with a "show me the website anyway"-button. I can't fix the CSS, because there are no alternatives. Believe me, I've tried.

User Agent strings

There are ALWAYS alternatives! CSS is the answer to rendering you pages cross-browser... even if a browser doesn't support something there are usually similar acceptable solutions for troublesome browsers. And there are a lot mor browsers than just IE, Firefox and Safari.... not a good idea to check them by "name" check by name / type. I am using a dev version of Firefox... it doesn't say firefox... it says Shiretoko, but uses the Gecko engine so you have to check for the engine that is the same.

This sample contains most of the options you might need... just change it to suit your needs. But remember, the User Agent string CAN be faked in various ways by the user. More info on User Agent strings.