Mobile Safari has a different user agent when standalone.
[pwl6.git] / src / yuu / core.js
index 22a1fb4..1d64e98 100644 (file)
@@ -7,6 +7,10 @@
 (function (yuu) {
     "use strict";
 
+    yuu.isSafari = function (ua) {
+        return /^((?!chrome).)*safari/i.test(ua || navigator.userAgent)
+            || navigator.standalone;
+    };
 
     yuu.require = function (m) {
         try { return require(m); }
                 wkdoc.dispatchEvent(ev);
             });
             win.on('new-win-policy', function (frame, url, policy) {
-                if (url.startsWith('chrome'))
+                if (url.startsWith('chrome')) {
                     policy.forceNewPopup();
-                else
-                    policy.forceDownload();
+                } else {
+                    policy.ignore();
+                    gui.Shell.openExternal(url);
+                }
             });
         }