Ver código fonte

fix: 'v' shortcut uses main browser in Safari PWA

When using the 'v' shortcut in a Safari PWA on macOS, Miniflux opened
the link in something similar to an 'in-app browser' with no URL bar and
a separate window for each link. When clicking the link with the mouse,
a "normal" browser tab is opened instead.

It looks like target="_blank" on the <a> element implies the "noopener"
attribute, which causes Safari to use the main browser. For window.open,
"noopener" is not implied. This commit adds the "noreferrer" argument to
the window.open call (which implies the "noopener" option) rather than
changing the window.opener attribute manually. This option causes Safari
to use the main browser with the 'v' shortcut.
Emiel Wiedijk 2 meses atrás
pai
commit
d40e523d25
1 arquivos alterados com 2 adições e 4 exclusões
  1. 2 4
      internal/ui/static/js/app.js

+ 2 - 4
internal/ui/static/js/app.js

@@ -42,10 +42,8 @@ function sendPOSTRequest(url, body = null) {
  * @param {string} url
  */
 function openNewTab(url) {
-    const win = window.open("");
-    win.opener = null;
-    win.location = url;
-    win.focus();
+    const win = window.open(url, "_blank", "noreferrer");
+    if (win) win.focus();
 }
 
 /**