jaydev wrote :
Hi,
I am looking for code to detect and redirect to the corresponding
browser download page if the clients uses old version, could anyone
have a sample code for this?
Hello jaydev,
You have an interesting and worthy post in there. It's definitely a good
question.
I want to use the following version browser only, if they are other
types I need to redirect to there download page.
Internet Explorer version 5.0and above
Netscape Navigator version 7.0 and above
Mozilla version 1.3 and above
Opera version 7.0 and above
I would not bother trying to detect Opera 7.x users: there are very few
users using Opera 7.x since they usually upgrade to the latest Opera
version all by themselves. It's MSIE 5.x, MSIE 6 users which would be
worth detecting and who are most likely to be sensitive to issues of
upgrading or migrating/switching to another browser name.
Safari/OmniWeb version 4.5 and above
Safari and OmniWeb upgrades are not free if I'm not wrong. So, here,
it's kinda difficult, delicate to tell them to upgrade. I think it's not
worth it otherwise it's not ok to annoy them, mainly for that reason.
Konqueror version 3.2 and above
You have to wonder if Konqueror users upgrade to the latest stable
Konqueror release available by themselves and, if not, why and if their
numbers (visits at your site) are worth the trouble to detect them (via
javascript or otherwise).
Appreciate any help
Thanks,
Jay
For any IE users, I think it is worth the efforts to invite such users
to either upgrade or to switch.
For other users, maybe just a link to a specific page listing where they
can get the latest version of their own browser name (and in such
webpage, telling them that browser upgrade is easy, free and will not
lose their profile info, bookmarks, emails, etc.. some people still
believe that upgrading browser version will make them lose their data
like bookmarks, preferences, etc.) would be good enough. What I mean
here is that, for instance, there are so few, so little Firebird users,
Phoenix users that it is not worth the problem to detect these users.
For NS 4.x users, I believe NS 4.x users are people who are not able to
perform browser upgrades by themselves and are going to actually upgrade
when they upgrade their computers or os: so, maybe it's not worth it.
Anyway, there are very few NS 4.x users on the web.
For any IE 5.x and IE 6 browsers, I suggest use of conditional comment:
<!--[if lte IE 6]>
<p>Some useful, relevant text, your speech here ...
<a href="
http://www.microsoft.com/windows/ie/default.mspx">Download
Internet Explorer 7</a></p>
<![endif]-->
or
<!--[if lte IE 6]>
<p>You're using an old Internet Explorer version which is known to be
prone to spywares, to have unpatched security weaknesses and to make
computers unsafe. For best security and better usability, please
consider switching to a better browser. Visit <a
href="
http://browsehappy.com/"><img
src="
http://browsehappy.com/buttons/bh_185x75.gif" width="185"
height="75 alt="Browse Happy" style="vertical-align: bottom;"></a> for
explanations and assistance.</p>
<![endif]-->
More on this:
http://msdn.microsoft.com/workshop/author/dhtml/overview/browserdetection.asp
I do **__not__** recommend user agent string detection: it's known to be
difficult to implement, unreliable and unmanageable in the long run.
Browser identification approach: not best, not reliable
Object/Feature support detection approach: best, most reliable
http://www.mozilla.org/docs/web-developer/upgrade_2.html#DevCrossBrowser
I personally believe people should prefer Firefox 2.0 or Opera 9.1
instead of choosing IE 7. This is also a very defendable decision. Or
you could even put a "browse happy" link/button/banner instead for IE
visitors and leave the whole decision up to the visitor.
http://browsehappy.com/
Then, the detection would / could go like :
<!--[if gt IE 6]>
<p>You're using Internet Explorer which is a browser known to have an
history of security concerns (to be prone to spywares, to have unpatched
security weaknesses, to make computers unsafe). I do not recommend the
use of Internet Explorer due to its relatively poor standards support
and security record, as well as its history of abandoning development
efforts. For all these reasons, I recommend switching to another browser
like <a href="
http://www.opera.com/download/">Opera 9.1</a> or <a
href="
http://www.mozilla.com/firefox/">Firefox 2.0</a> which are
available in many languages. Also, you may want to visit <a
href="
http://browsehappy.com/"><img
src="
http://browsehappy.com/buttons/bh_185x75.gif" width="185"
height="75 alt="Browse Happy" style="vertical-align: bottom;"></a> for
explanations and assistance.</p>
<![endif]-->
Downloadable Promotional graphics from Browser Happy
http://browsehappy.com/badges/
For Netscape Navigator, Mozilla, Phoenix, Firebird, Firefox 1.0.x users,
you will need to rely on userAgent string detection. If you decide to go
for this (if you have assessed that it's worth the trouble to detect
these users and then to invite them to upgrade), then you will need to
detect in the correct order navigator.product, navigator.vendor (and
possibly navigator.vendorSub too), navigator.productSub.
I would first try to detect Phoenix users, Firebird users and Firefox
1.0.x users. All Netscape users (NS 7.x, NS 8.x) could be also detected too.
if(navigator.product == "Gecko" && navigator.productSub &&
navigator.productSub > "20060201")
/* I don't think it's acceptable or justified to annoy people using a
less than 6 months old browser version */
{
if(navigator.vendor && possibly navigator.vendorSub=="Netscape")
{
...more code to develop...
}
else if()
{
...more code to develop...
};
}
Gérard