Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138163

Firefox deletes persistent Cookies

$
0
0

I've been trying to get a html/js based Language selection system to work and I need a persistent cookie for it, which saves the choice of Language the user made, for a certain amount of time. Sadly this cookie is mistaken by Firefox for an activity tracking cookie(which it kinda is), and thus is deleted, when the session ends. Can I prevent this from happening somehow?
If this script would work, my finished code should work aswell:

if(document.cookie==""){
            document.cookie = "test=Hello World; max-age=3600";
        }
else{
            window.location.replace("https://www.youtube.com/");
        }

What it should do:

  1. The first time the site is opened, a cookie is set and nothing further happens.
  2. The second time the user gets redirected to youtube.com.

This Image shows Firefox's blocked scripts for activity tracking over the past week


Viewing all articles
Browse latest Browse all 138163

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>