瀏覽代碼

Merge pull request #2439 from cpmsmith/window-open-noopener

fix: open external links in default browser from macOS PWA
Simon Legner 9 月之前
父節點
當前提交
03c4c5e6f9
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      assets/javascripts/lib/util.js

+ 2 - 2
assets/javascripts/lib/util.js

@@ -457,13 +457,13 @@ $.noop = function () {};
 
 
 $.popup = function (value) {
 $.popup = function (value) {
   try {
   try {
+    window.open(value.href || value, "_blank", "noopener");
+  } catch (error) {
     const win = window.open();
     const win = window.open();
     if (win.opener) {
     if (win.opener) {
       win.opener = null;
       win.opener = null;
     }
     }
     win.location = value.href || value;
     win.location = value.href || value;
-  } catch (error) {
-    window.open(value.href || value, "_blank");
   }
   }
 };
 };