JS - Mobile - Open Safari from any browser

Viewed 7189

Since Apple allow use of camera in Safari (Mobile), we can do a lot things, but sharing them is hard. You cannot open a website in Safari from another browser directly (Chrome, FacebookBrowser, MessengerBrowser, SkypeBrowser...).

Safari has 4 URL Schemes:

(HTTP) — http://websiteurl

(HTTPS) — https://websiteurl

x-web-search:// - Google search in Safari

(FTP) — ftp://locationtofileonftpserver

If you use <a href="https://somewebsite"></a> or window.open("http://somewebsite"). It always uses the current browser to open URL.

x-web-search://?[query] - It will open Safari but using Google and search something in query

Hence, only ftp remains. If you want to open website (HTTPS) in Safari, you will need a bridge html file in your ftp server and open it as:

ftp://your_ip_address/bridge.html Now, the only thing "bridge.html" does is

<script>
    window.open("https://your_url", "_self");
</script>

And Safari will open your website from any browser

You can add params URL to your ftp link (ftp://your_ip_address/bridge.html?url=https://someURL) Catch it in bridge.html before window.open

Hope it helps. Good luck.

0 Answers
Related