How to differentiate sites with Javascript? Besides URL

Viewed 20

Hey guys what's up? My goal is to save variables in cookies so I can get them later. I was using the URL to differentiate the sites, but I found one that change the URL every time I refresh the page, more specifically Youtube with Playlists. I could easily do some work around because it's only the last digits that change, but I would like to know if there is a smarter way to resolve this, like some 32 hex code or something like that (sorry if this sound ridiculous) or maybe some way to get a specifically but complex information about the site that could difference them even from others in the same domain (maybe mix info together, i don't know).

What happens with Playlist when I refresh: https://www.youtube.com/watch?v=_mk6Y4ahhnE&list=PLe9...y0&index=1

After refresh: https://www.youtube.com/watch?v=_mk6Y4ahhnE&list=PLe9...y0&index=2

When changes the URL, my code it's useless. Here is what I have:

function setCookie(uniqueInfoVariable,valueOfVariable){
...
}
setCookie(window.location.href + 'variable', valueOfVariable;

Any other ideas of what I can use instead of 'window.location.href' here? Thank you before hand!

0 Answers
Related