Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>JavaScript cookies are a solution although I should point out that it will only work for as long as the user keeps the cookie.</p> <pre><code>//set the cookie when they first hit the site function setCookie(c_name,value,exdays) { var exdate=new Date(); exdate.setDate(exdate.getDate() + exdays); var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()); document.cookie=c_name + "=" + c_value; } //check for the cookie when user first arrives, if cookie doesn't exist call the intro. function getCookie(c_name) { var c_value = document.cookie; var c_start = c_value.indexOf(" " + c_name + "="); if (c_start == -1) { c_start = c_value.indexOf(c_name + "="); } if (c_start == -1) { c_value = null; } else { c_start = c_value.indexOf("=", c_start) + 1; var c_end = c_value.indexOf(";", c_start); if (c_end == -1) { c_end = c_value.length; } c_value = unescape(c_value.substring(c_start,c_end)); } return c_value; } </code></pre> <p>code is from <a href="http://www.w3schools.com/js/js_cookies.asp" rel="nofollow noreferrer">http://www.w3schools.com/js/js_cookies.asp</a></p> <p>obviously there's some blanks you'll have to fill in there, but it's a good starting point for working with cookies in javascript.</p> <p>EDIT:</p> <p>So you want to make a new function, put it in the head, inside script tags (if you have them already, just copy the function into there (you'll want to put the other two functions I provided within the script tag also)). This function will check to see if you have a cookie. If you do, just return. If you don't, create the cookie and run the intro,</p> <pre><code>&lt;head&gt; &lt;script type="text/javascript"&gt; function checkCookieIntro(){ var cookie=getCookie("mySite"); if (cookie==null || cookie=="") { setCookie("mySite", "1",90); runIntro(); //change this to whatever function you need to call to run the intro } } &lt;/script&gt; &lt;/head&gt; </code></pre> <p>now change your body to be:</p> <pre><code>&lt;body onload="checkCookieIntro()"&gt; </code></pre> <p>so when the body loads it will check to see if a cookie exists, if it doesn't, create a cookie with a value of one that will last for 90 days (unless the user deletes it) and then run the intro. If the cookie does exist with a value then it does nothing.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload