S
S
SergejScherbakov2018-05-05 07:46:23
JavaScript
SergejScherbakov, 2018-05-05 07:46:23

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

2 answer(s)
O
Oleg, 2018-05-05
@402d

cookies can be set for any period. 1000 days on the Internet - can be considered as FOREVER.

F
frees2, 2018-05-05
@frees2

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 question

Ask a Question

731 491 924 answers to any question