Answer the question
In order to leave comments, you need to log in
How to remember the url for each visitor on your site?
There was a technical need to remember the url where the client stopped when viewing the site and to replace the standard url with the one saved during a second visit, but within the same site. Having studied the issue, I came to the conclusion that it can be implemented either through a session or through cookies. It is not clear with the session. after closing the browser, it will not be possible to work with the client, and cookies have a short lifespan. Has anyone faced a similar issue?
Answer the question
In order to leave comments, you need to log in
cookies can be set for any period. 1000 days on the Internet - can be considered as FOREVER.
The visitor's browser string, specifically after #
var location = window.location.href.split('#')[1];
localStorage.setItem('history',location);
//window.localStorage.clear();
if (localStorage.getItem('history') === null) { document.getElementById("hidetext666").innerHTML ='Добро пожаловать! ' ; }
else{ document.getElementById( 'result' ).innerHTML =localStorage.getItem('history'); };
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question