Hi, i try this script to check browser version and redirect the user to update their browser:
It work prefectly for Internet Explorer but not the other browser, is there something wrong with my script here?Code:function get_browser_version(){ var N=navigator.appName, ua=navigator.userAgent, tem; var M=ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i); if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1]; M=M? [M[1], M[2]]: [N, navigator.appVersion, '-?']; return M[1]; } var browser = navigator.appName; var version = get_browser_version(); if (browser=="Microsoft Internet Explorer") { if (version<="9.1") document.location.href="upgrade.php" } if (browser=="Safari") { if (version<="6.0") document.location.href="upgrade.php" } if (browser=="Firefox") { if (version<="5.0") ddocument.location.href="upgrade.php" } if (browser=="Chrome") { if (version<="15.0") document.location.href="upgrade.php" } if (browser=="Opera") { if (version<="11.10") document.location.href="upgrade.php" }![]()



Reply With Quote
Bookmarks