Forum Moderators: open
The first I can see is that you are increasing your workload by having to develop different pages for different browsers.
For browser sniffing I tend to stick to client side languages and have never done it in a server side language (is it possible? ASP/PHP/JSP gets run by the server before being shipped out to the client?).
You could also use IE conditionals, which tedster has explained here [webmasterworld.com]. Using both the link and @import css calls, allows you to cater for modern browsers and NN4.x, and some JavaScript sniffing can allow you to present a style sheet to each particular browser, as well as alerting them to upgrade if you want.
Also, here is what I'd like to do. Basically, identify if a user is browsing with Internet Explorer Version 5, and if so, present them with a screen that has a link to an upgrade site, possibly a picture and a paragraph of text.
Since I'm only testing for one browser, it seems like I could forgo lengthy javascripts and just insert one or two lines of code plus my html. Is this possible?
//detect IE5.0
if (navigator.appVersion.indexOf("MSIE 5.0")!=-1)
alert("You're using IE5.5!")
>> Really don't know javascript, how would I need to present my html with this.
Thanks for any help.
M
If you are using php, you can call this in the head section of your page, and then use an if statement to write an alternative page for IE5 browsers, or the originally intended page for anything else.
If you use Javascript you will miss anybody who has it turned off.
[edit]On thinking about it, I can't imagine anything that is going to annoy a user more than being diverted to a page which is really nothing more than an advert telling them their equipment is crap! :)[/edit]
It's one thing to use browser sniffing to improve the visitor's experience depending on the browser they use .. and another thing to mess things up or exclude visitors just because they use a certain browser.
For example .. I could care less about NN4 browsers .. But, I still make sure they will be able to use my sites. Sure, the layout it far from what it's intended to be .. But it's not messed up.
madcat, I don't think there are any downsides to browser sniffing - as long as you do it in a smart way. Also, if you only do it when it's a necessity, I can't see why it should cause any problems.
Just make sure that the default content is viewable by all browsers.
Use browser sniffing to add content, not remove :)