What is an effective way to move data from one open browser tab to another?

I am looking for a quick way to capture some data from one web page and throw it into another. I do not have access to the query string in the URL of the second page, so transferring data this way is not an option. Right now, I'm using a Greasemonkey script user in tandem with a JS booklet trigger:javascript:doIt();

// ==UserScript==
// @include        public_site
// @include        internal_site
// ==/UserScript==

if (document.location.host.match(internal_site)) {
  var datum1 = GM_getValue("d1");
  var datum2 = GM_getValue("d2");
}

unsafeWindow.doIt = function() {
  if(document.location.host.match(public_site)) {
    var d1 = innerHTML of page element 1;
    var d2 = innerHTML of page element 2;
    //Next two lines use setTimeout to bypass GM_setValue restriction
    window.setTimeout(function() {GM_setValue("d1", d1);}, 0);
    window.setTimeout(function() {GM_setValue("d2", d2);}, 0);
  }
  else if(document.location.host.match(internal_site)) {
    document.getElementById("field1").value = datum1;
    document.getElementById("field2").value = datum2;
  }
}

Although I am open to another method, I would prefer to stay with this basic model, if possible, as this is just a small part of the code in doIt()that is used on several other pages, mainly for automating date-filling forms; people really like their magic button.

, : , , , . , , GM cookie , , . , GM_getValue() clicklet-clicktime, . !

+3
1

- Greasemonkey ? click-event GM_getValue().

, " " - , . Firefox.

, : http://articles.sitepoint.com/article/ten-tips-firefox-extensions/1

0

Source: https://habr.com/ru/post/1732637/


All Articles