JavaScript供iPhone通过非默认iOS浏览器在Safari中打开



" googlechrome://www.lego.com"在移动野生动物园中打开的将切换到Google Chrome iOS应用程序以打开URL。这允许下面的脚本集,它允许您在Google Chrome iOS应用中打开当前页面,从移动Safari切换:

(function()%7Bif(document.location.href.indexOf('http')===0)document.location.href=document.location.href.replace(/%5Ehttp/,'googlechrome');%7D)();

我的问题是,可以做到吗?我尝试了" Safari://www.lego.com",这只是一个无效的URL。您可以制作一个scriptlet,将 Google Chrome 转换为移动Safari以打开当前页面。

答案是肯定的。礼貌或宏观(http://www.macstories.net/tutorials/chrome-for-ios-send-a-webpage-back-back-to-safari-via-bookmarklet/),我找到了此代码:

window.location='googlechrome-x-callback://x-callback-url/open/?url='+encodeURIComponent(location.href)+'&x-source=Safari&x-success='+encodeURIComponent(location.href);

执行该代码,转到您的房屋屏幕,重新打开Chrome,并且有一个神奇的后背按钮可以返回Safari。这可能不是您想要的,但它起作用...

的纠结

祝你好运!

更新:这是一个屏幕截图:链接(对不起,我没有足够的声誉将其正确地放在帖子中):https://i.stack.imgur.com/or175.jpg

更新:
似乎这样做的功能已经破裂了。谢谢!

最新更新