deepak-rajpal
5/16/2013 - 10:42 AM

1) IE-Based browser warning in Header, remove on click by storing cookies information and don't show it again. 2) Once clicked on 'X' it wi

  1. IE-Based browser warning in Header, remove on click by storing cookies information and don't show it again.
  2. Once clicked on 'X' it will be omitted.

Steps to re-occur browser warning:

  • Remove cookie by pressing F12 > Cache > Clear Session Cookies
  • Now refresh and check, It should display warning.
<html>
<head>
<style>
/* IE header Warning css */
#ie-warning { line-height:37px; color:#fff; background-color: #e4042b; font:bold 14px arial; margin:0px auto; padding:8px 0 8px 0; text-align:center; }
#ie-warning a, #main-header #ie-warning a:visited{ color:#fff; text-decoration:underline; }
#ie-warning a:hover{ color:#fff; text-decoration:none; }
#ie-warning .warning-close { font-size:12px; cursor:pointer; }
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
    $(document).ready(function() { 
		$('.warning-close').live('click', function () {
			$(this).parent().fadeOut('fast', function () { $(this).remove(); });
			document.cookie = "firsttime=1;path=/";
		});
	});
</script>
</head>
<body>
<?php 
	if (!isset($_COOKIE['firsttime']))
	{ ?>
		<!--[if IE]>
		<div id="ie-warning">
			This site is best viewed using <a target="_blank" href="http://www.mozilla.org/en-US/firefox/new/"> Firefox</a> and <a target="_blank" href="https://www.google.com/intl/en_uk/chrome/browser/"> Chrome</a>. <sup title="Close Warning" class="warning-close"> &nbsp; X </sup>
		</div>
		<![endif]-->
<?php } ?>
</body>
</html>