Browse Source

fix: open external links in default browser from macOS PWA…

…by using `window.open(url, "_blank", "noopener")` directly instead of a
now-rarely-needed workaround.

Fixes freeCodeCamp/devdocs#2438
Calum Smith 9 months ago
parent
commit
d426b47166
1 changed files with 2 additions and 2 deletions
  1. 2 2
      assets/javascripts/lib/util.js

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

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