xbsoftware / enjoyhint

MIT License
777 stars 275 forks source link

It loads only first time #20

Open swapnil05 opened 9 years ago

swapnil05 commented 9 years ago

whenever I am refreshing the page it loads automatically. help me to fix the issue. I just want it to load only one time when the user login for first time.

asaskevich commented 9 years ago

You can use localStorage and check whether user running the script the first time:

// .. some code
var wasShown = 'enjoyhint:wasShown';
if (localStorage.getItem(wasShown)) {
  // EnjoyHint was shown, etc
} else {
  // Load it and do things necessary for the first time
  localStorage.setItem(wasShown, true);
}
// .. some code
rezast commented 5 years ago

You can use localStorage and check whether user running the script the first time:

// .. some code
var wasShown = 'enjoyhint:wasShown';
if (localStorage.getItem(wasShown)) {
  // EnjoyHint was shown, etc
} else {
  // Load it and do things necessary for the first time
  localStorage.setItem(wasShown, true);
}
// .. some code

i have same problem but i do not understand because i have basic knowlege please give me one code for play once time for ever for new users and put this code in TODO demo sample and give me .thanks