Welcome to the Power Users community on Codidact!
Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.
Post History
Background: I'm using a websites which uses a pin code locally stored in a cookie for login. As firefox does not recognise the field to input the pin as a password field, it won't store the passwo...
#1: Initial revision
Setting a cookie with a userscript
### Background: I'm using a websites which uses a pin code locally stored in a cookie for login. As firefox does not recognise the field to input the pin as a password field, it won't store the password for me. To avoid having to remember the pin myself, I'm using a greasemonkey user script to automatically set the cookie (security is not a concern, the website in question does not hold any important or personal information, so I don't mind that the pin is stored as plain text on my computer) The user script I'm currently using looks like this: ``` // ==UserScript== // @name test // @match *://example.com/* // @run-at document-start // @grant none // ==/UserScript== (function() { 'use strict'; document.cookie = "uuid=xxx"; })(); ``` ### Problem: The above user script works fine on the second time. On the first time I open the website I won't be logged in, but if I reload the site or open a second tab, I'm logged in. So apparently the cookie is correctly created, but too late. Is there a way to create the cookie earlier? --- I'm using - greasemonkey 4.11 - firefox 102.3.0ESR - macOS 11.6.8