Search code examples
javascriptcookiesbookmarklet

Trying to make a Bookmarklet to set a cookie every 6 seconds


I am not experienced Javascript but I am trying to make a bookmarklet that will run document.cookie (with some arguments) every 6 seconds. I can get the bookmarklet to to the cookie but I cannot figure out how to make a loop. I tried googling how to make a loop and putting it into a javascript to bookmarklet generator but that didn't work. Can someone please give me the Bookmarklet code (like javascript:blablabla) with something like for every 6 seconds? Thank you so much for reading this

Edit: Also the bookmarklet goes to a different page with the new cookie data but never goes back to the original page, can you guys tell me how to set a cookie without it going to another page?


Solution

  • Use setInterval();, it wil execute given function every x milliseconds W3 schools page.