You need to display the popup only when you first enter the page or when you open the pages in new tabs. Interested in options for implementing this behavior. Jq does not help. Please prompt or suggest.
3 answers
To track the first visit, you can use a cookie.
For tracking other tabs - web storage.
|
Use cookies (javascript):
if (getCookie('visited') == 1) { // повторное посещение } else { // первое посещение setCookie('visited', 1); } There are plenty of examples of get / set Cookie on the web.
- The name is normal, it does n’t follow exactly which server is used, so the php example doesn’t fit from any side - Grundy
- Corrected headline - Grundy
- oneSelf-advise your answer no need. It was enough to remove the irrelevant part. - Nofate ♦
|
Thank you all, in the end I found a rather simple solution through window.sessionStorage
function showSea() { //check the session param if (!window.sessionStorage.getItem('done')) { ...do-something //set the session param sessionStorage.setItem('done', 1); } } |