Skip to content

Instantly share code, notes, and snippets.

View goergisn's full-sized avatar
🦦

Alex Guretzki goergisn

🦦
View GitHub Profile
@zengfenfei
zengfenfei / openApp.js
Last active August 4, 2021 15:18
Open native app from webpage, mobile safari "invalid address" warnings be suppressed when the app is not installed.
/*
Open native app through iframe so that mobile safari "invalid address" warnings be suppressed when the app is not installed.
* `window.location=url` will not open native app in the iframe of android chrome
* Android will go to the next page even if the url scheme is not supported
*/
function openApp (url) {
if (window.chrome && navigator.userAgent.search(/\bChrome\b/)!=-1) {
window.location = url;
} else {