View Full Version : Need script to check browser version - to redirect to another page!

06-12-2008, 02:38 PM
I am looking for a script that I could place in the header of my main .com page that would check the user's browser and if its older than (explorer 6, or Netscape 5) to redirect them to a HTML page, example update.htm
Any help would be appreciated


06-13-2008, 08:43 AM
<script type="text/javascript">
var num = /MSIE/.test(navigator.userAgent)?
navigator.userAgent.replace(/^.*MSIE (\d+).*$/,'$1') - 1 :
if(!isNaN(num) && num < 5)
window.location = 'update.htm';

However, not knowing why exactly you want this, it is an open question in my mind as to whether or not a browser earlier than that wouldn't still 'barf' on your page if your page also had other code on it that the browser couldn't handle.