/ Published in: HTML
Simple mix of basic CSS, HTML, and jQuery to detect IE and display a message to the user encouraging them to update.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!-- OBVIOUSLY YOU WOULD PUT THE STYLES AND SCRIPTS IN EXTERNAL FILES... --> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style> #ie-box { display: none; } /* this goes in your main stylesheet */ </style> <!--[if lt IE 9]> <style> /* Internet Explorer Warning Message */ #ie-box { display: block; position: absolute; height: 100%; width: 100%; z-index: 100 } #ie-warning-overlay { background: #000; height: 100%; width: 100%; overflow: hidden; position: fixed; z-index: 110 } #ie-warning-wrap { background: #FFF; position: absolute; z-index: 120; height: 300px; width: 500px; left: 50%; top: 50%; margin-top: -150px; margin-left: -250px } #ie-warning-wrap #ie-warning-msg { padding: 15px; position: relative; text-align: left } #ie-warning-wrap #ie-warning-msg h3 { padding: 10px; color: #fff; background-color: #990000 } #ie-warning-wrap a.close { z-index: 150; font-family: Arial, Helvetica, sans-serif; font-size: 10px; font-weight:bold; position: absolute; bottom: 15px; right: 15px; text-decoration: underline } #ie-warning-wrap #ie-warning-msg p { margin-bottom: 15px } #ie-warning-wrap a, #ie-warning-wrap a:visited { color: #990000 } #ie-warning-wrap #ie-warning-msg ol li span { font-style: italic; color: #999999 } .transparent { /* IE 8 */ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; /* IE 5-7 */ filter: alpha(opacity=50); /* Netscape */ -moz-opacity: 0.5; /* Safari 1.x */ -khtml-opacity: 0.5; /* Good browsers */ opacity: 0.5 } .opaque { /* IE 8 */ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; /* IE 5-7 */ filter: alpha(opacity=100); /* Netscape */ -moz-opacity: 1; /* Safari 1.x */ -khtml-opacity: 1; /* Good browsers */ opacity:1 } </style> <![endif]--> <script> /* Add Close function for IE Modal */ $('.close').bind('click',function(e){ e.preventDefault(); $('#ie-box').fadeOut('slow'); }); </script> </head> <body> <div id="ie-box"> <div id="ie-warning-msg"> <ol> </ol> </div> </div> </div> </body> </html>