Run JS only once (check IE version)

RobertNZana used Ask the Experts™
I saw an article (click here) which discussed how to check the version of IE a user is using.

On my website I want to basically (1) check their IE version (IF they are using IE), then (2) if it's < version 7 alert them with a message. This block of code should go on every page. (I put it in <body onload="check_version();"> ).

But I only want the alert to show up 1 time ONLY! So if they visit the website again the message will only show up once (if any) and won't reappear for a while (ie until the browser is restarted etc) I don't want the alert to pop up on every page of the website, though they may navigate the entire site.

How can I do this exactly? I don't know js so detailed code samples are appreciated. Thanks
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2014

cookies :

Check here how to set and get their values :


Can someone provide some actual sample code doing this using cookies? I'm not too familiar with js. Thanks.
Top Expert 2014
just check the link provided, no need to be familiar with js
function alertOrNot() {
  if( getCookie("ieversion") == "") {
       var iever = getInternetExplorerVersion();
       setCookie("ieversion", iever)
       if(iever<7) {
           alert("your ie version < 7");
<body onload="alertOrNot();">

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial