Skip to content

Instantly share code, notes, and snippets.

Created Sep 2, 2011
What would you like to do?
Simple IE 6 alert with conditional comments and jQuery
// Grab the message from the text file
var ie6message = 'alert.txt';
// Create a div to hold the alert
var alertdiv = $('<div id="alert">');
// Load the message into the div
// Insert the message into the page. Notice the .ie6 class, which only appears when using IE 6.
$('.ie6 body').prepend(alertdiv);
<h1>Whoa there!</h1>
<p>That's a pretty old browser you got there. You'll have a better experience here if you upgrade to something from the past decade. I recommend <a href="" title="Chrome">Chrome</a> or <a href="" title="Firefox">Firefox</a>.</p>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<title>Simple IE 6 alert with conditional comments and jQuery</title>
<script src=""></script>
<script src="script.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment