I have page on my site. Let's say it's:
https://example.com/consulting/#ref/testing
and on that link there is input field:
<input type="text" value="" id="input19" />
So I want to do the following action:
Split the URL in the browser, so I had last word from the link (in this case it's "testing"). I'm using following script for this:
var url = document.URL;
var match = url.match(/([^/]*)$/);
console.log(url);
console.log(match);
That script will give me last word from the link in this example it's "testing" and I need this word ("testing") to be written in cookies before browser is closed and from cookies it should be inserted in the above mentioned input field with the id "input19".
This cookie should not be changed before it's deleted. When user will browse the site and after returns to the above mentioned page value from cookie should be inserted in the input field as well.
Could you give me a solution on how I can achieve this?