Mobile app version of vmapp.org
Login or Join
Angie530

: What's the best way to show a message for only IE 6 and IE 7? What's the best way to show a text message for only IE 6 and IE 7 ? Should I add a html tag to my webpages and normally

@Angie530

Posted in: #Css #Html #InternetExplorer

What's the best way to show a text message for only IE 6 and IE 7 ?

Should I add a html tag to my webpages and normally hide it with css for all browsers except the above mentioned ?

And when I use IE6 IE7, should I hide the website with css and show only that html tag ?

thanks

10.06% popularity Vote Up Vote Down


Login to follow query

More posts by @Angie530

6 Comments

Sorted by latest first Latest Oldest Best

 

@Margaret670

would the reason you would be showing different content is the reason you are using HTML5, which is non-compatible with IE7 & below?

10% popularity Vote Up Vote Down


 

@Gail5422790

So - what's the reason to want to "hide the website" from ie6/7? if it's user agent specific messaging, I'd vote for conditional comments.

10% popularity Vote Up Vote Down


 

@Lee4591628

Add these type of HTML conditional comment in your page HTML source

<!--[if IE 6]>
<h1>Hello, u r using IE6, your message here</h1>
<![endif]-->

<!--[if IE 7]>
<h1>Hello, u r using IE7, your message here</h1>
<![endif]-->

<!--[if lt IE 8]>
<h1>Hello you are using a version of IE less than IE8, your message here</h1>
<![endif]-->


All above will be skipped like normal HTML comment by ALL browsers except IE that will parse these and beahve accordingly.

10% popularity Vote Up Vote Down


 

@Turnbaugh106

Use Conditional Comments that only IE browsers support.

10% popularity Vote Up Vote Down


 

@Smith883

Conditional CSS commenting or use the JQUERY browser detection:

Link to CSS conditional Comments

Link to Jquery browser detection

Using these you can set styles like hide the divs of normal content and display the divs of alternate content. Or us JS to alter the content and how it's displayed.

If you're looking to just remove everything for IE6 users and show them a message telling them to update you can set the CSS to hide everything inside the body, and throw an alert onload with the jquery detection. It's harsh, but should work the majority of the time so long as they aren't trying to be sneaky or bypass this. In which case they probably aren't the people you are targeting.

10% popularity Vote Up Vote Down


 

@Kevin317

It's tough to limit access to a website by browser because there is no 100% foolproof way to do it.

Your first problem is user-agent spoofing. Browsers can identify themselves with any user-agent they want to. Browsers with extensions all seem to have one that makes doing this trivial. If someone with IE6 or IE7 changed their user-agent to be that of IE8 or Firefox they'll get into a website.

You can use JavaScript to overcome that issue by using feature detection. Basically you use JavaScript to do a simple test: you check to see if a piece of functionality that doesn't exist in IE6 or IE7 exists. If it doesn't, you know it's them. The problem with this is if they turn off JavaScript they easily bypass this.

A multi-tiered approach would be to browser sniff on the server side using their user-agent, ideally in Apache or IIS, and redirect those users to a page telling them you don't support their browser. BTW, that's more polite then simply hiding the website. I'd augment that with the JavaScript feature detection method. Between the two of them you'll catch all but the most technically savy users and the odds are they aren't using IE6 or IE7 anyway.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme