0

Im running two scripts using greasemonkey in mozilla firefox. The scripts run on different websites. In the first script i want to save a variable "globally" into firefox so i can use it in the second script on another website.

button.onclick = function() {myFunction()};

function myFunction() {
  //localStorage.setItem('savedvariable', document.URL)
  //window.name = document.URL;
  //sessionStorage.setItem('savedvariable', document.URL)
  //document.cookie = "savedvariable=" + document.URL;
}

All the options i tried didnt work, so looking for a workaround.

In the second script i wish to set a textbox value to the saved variable from the first script :

var TextBox = document.getElementById("downloadUrlLabel");
TextBox.value = "placeholder variable";

Is there a way to make something like this happen (saving a variable into firefox globally), without making it complicated?

PS : sorry if this has been answered before, tried looking for it but couldnt find it

0 Answers0