将应用浏览器中的 Instagram 转义到 safari [英] Escape instagram in app browser to safari

查看:24
本文介绍了将应用浏览器中的 Instagram 转义到 safari的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有一个链接,该链接重定向到 instagram 登录以获取一些照片,但该页面在 ios 设备上的 instagram 应用内浏览器上不起作用.我的想法是放置一个链接,以便用户可以单击它并重定向到 safari 或默认浏览器中的页面,这可能吗?

I have a link in my website that redirects to instagram login to fetch some photos, but that page doesn't work on the in app browser from instagram, on an ios device. My idea is to put a link so the user can click it and be redirected to a page in safari or the default browser, is that possible?

<a id="link" href="http://www.google.com">Google</a>

推荐答案

不是一个完整的答案,但可能是一个线索.只需在 html body 的开头放一些阻塞的 js 代码即可.

Not a complete answer, but could be a clue. Just put some blocking js code in the beginning of a html body.

<script>
    var str = navigator.userAgent;
    var i = str.indexOf("Instagram");
    if (i != -1) {
      document.write("<a target=\"_blank\" href=\"http://instagram.com/?nibrowser=no\">Proceed to Sfari</a>");
      window.stop();
    }
</script>

关于 Instagram 用户代理的一些信息:https://mpulp.mobi/2016/07/12/instagram-user-agent/

Some info about Instagram user agent: https://mpulp.mobi/2016/07/12/instagram-user-agent/

关于强制应用浏览器打开 Safari:https://support.interact.technology/support/solutions/articles/17000003729-how-to-force-a-link-to-open-in-safari-ios-only-

On forcing in app browsers to open Safari: https://support.interact.technology/support/solutions/articles/17000003729-how-to-force-a-link-to-open-in-safari-ios-only-

并且 window.stop() 几乎可以阻止所有浏览器中的页面加载.希望能帮到你.

And window.stop() just prevents page load almost in all browsers. Hope it'll help.

这篇关于将应用浏览器中的 Instagram 转义到 safari的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆