admin管理员组

文章数量:1357583

I've got this Tampermonkey extension:

// ==UserScript==
// @name         Open Window and Change Address
// @match        /
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @run-at       document-idle
// ==/UserScript==

(function () {
  "use strict";

  function delay (time) {
    var stop;

    stop = Date.now() + time;

    while (Date.now() < stop) {}
  }

  function enter () {
    var i;
    var u;
    var w;

    try {
      for (i = 0; i < urls.length; i++) {
        u = urls[i];

        if (i === 0) {
          w = window.open(u);
        } else {
          delay(250);
          w.location.href = u;
        }
      }
    } catch (e) {
      alert(String(e));
    }
  }

  var btn;
  var urls;

  try {
    urls = [
      "/",
      "/"
    ];
    
    enter();
  } catch (e) {
    alert(String(e));
  }
})();

It's supposed to open a new tab at address and then change the address in that tab (the purposes for this are irrelevant). I have pop-ups turned on in Safari. The problem is that the tab window.open opens is blank and there is nothing in the address bar. I don't get it. Websites are able to do this. Why isn't this extension able to do it?

本文标签: domwindowopen not loading address in Safari on iOSStack Overflow