Jump to content

Problem in IE Detector Code


fazlionline

Recommended Posts

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 by fazlionline
Link to comment
Share on other sites

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>

Link to comment
Share on other sites

  • 3 weeks later...

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...