fazlionline Posted July 26, 2010 Report Share Posted July 26, 2010 (edited) Hi all, I want to check if the user is using Internet Explorer 7 or above, if it is version 7, he should have an Alert saying “You're using 7.x, please update your IE” and if he has version 8 so NO alert should appear. My code is bellow but I am getting alert for both versions. Need help <script type="text/javascript"> if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x; var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number if (ieversion>=8) alert("") else if (ieversion>=7) alert("You're using 7.x, please update your IE") } </script> Edited July 26, 2010 by fazlionline Quote Link to comment Share on other sites More sharing options...
Wickham Posted July 26, 2010 Report Share Posted July 26, 2010 What happens if you leave out the IE8 code (you don't need to tell the user anything if he is using IE8):- <script type="text/javascript"> if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x; var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number if (ieversion>=7) alert("You're using 7.x, please update your IE") } </script> Quote Link to comment Share on other sites More sharing options...
monkeysaurus Posted August 17, 2010 Report Share Posted August 17, 2010 Easy-peasy way, doesn't rely on navigator.userAgent (which can be spoofed): <!--[if lt IE 8]> <script type="text/javascript"> alert("You're using 7.x, please update your IE"); </script> <![endif]--> Quote Link to comment Share on other sites More sharing options...
newseed Posted August 17, 2010 Report Share Posted August 17, 2010 I would rule against notifying users of IE7 to upgrade because that's a big chunk of the market. Besides, there may be a variety of reasons why users don't upgrade. One is that the employer will not allow it. However, I would be in favor using it for IE6 users. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.