强制iOS Facebook应用程序在浏览器中打开不在WebView中的Feed链接 [英] Force iOS Facebook App to open feed links in Browser not in WebView

查看:114
本文介绍了强制iOS Facebook应用程序在浏览器中打开不在WebView中的Feed链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(在downvoting /标记之前请注意,已经有类似的问题,但没有一个使用简单的javascript)



每当一个在Facebook-Feed上的链接被点击在iOS设备上(仅通过Facebook应用程序),它将在WebView中打开,而不是在新的浏览器窗口中打开(就像在Android上)



当这种情况发生时,即将打开的Web应用程序中断,所以我需要欺骗iOS,并强制它打开用户标准浏览器(Web应用程序完美无缺地运行)中的链接。 >

如果只有当按钮被klicked时,这样做也是没有问题的。但是从我在WebView中打开的所有内容,我只是无法让它在浏览器中打开它。



我看过几个ObjectiveC解决方案我当然不能在网络应用程序中使用它。所以我想坚持JS / HTML(或PHP,但我不认为这将是一个很大的帮助)



什么不工作:

 < a href =http://google.comtarget =_ blank>我的链接文本< / a> 

与目标属性的常规链接不会做到这一点。该链接将改为在WebView中打开。

  window.open('http://google.com'); 

window.open (当然我把它附加到事件处理程序)。似乎webview不会对 window.open()反应。



所以这里的任何人都有解?我希望这不是一些奇怪的iOS指南。

解决方案

这个行为是由Facebook应用程序控制的。 iOS上有一个明确的调用来打开系统工具的URL(例如常规网址的Safari)。如果Facebook应用程序通过其内置的Web视图打开URL,那么您可以做的不多。


(Before downvoting/flagging please note that there are already similar questions but none of them do work with plain javascript)

Whenever a Link on the Facebook-Feed is clicked on an iOS device (only via facebook app) it will open in a WebView and not in a new browser window (like it is on android).

When this happens, the web application that is about to be opened breaks, so I need to trick iOS somehow and force it to open the link in the users standard browser (where the web application works flawlessly).

If that's only possible when a button is klicked it would also be no problem. But from what I have tried everything opened in the WebView and I just could not get it managed to open it in the browser.

I've seen a couple of ObjectiveC solutions which I cannot of course make use of in a web application. So I'd like to stick to JS/HTML (or PHP but I don't think it will be much of a help)

What does not work:

<a href="http://google.com" target="_blank">My Link Text</a>

A normal link with the target attribute will not do the trick. The link will instead open within the WebView.

window.open('http://google.com');

window.open won't work neither (of course I've attached it to an event handler). It seems that the webview will not respond to window.open() anyways.

So anyone here who has a solution? I hope that's not some weird iOS guidline.

解决方案

This behaviour is controlled by the Facebook app. There is an explicit call on iOS to open a URL with the system tool (such as Safari for regular web addresses). If the Facebook app is opening URLs via its in-built web view then there isn't much you can do

这篇关于强制iOS Facebook应用程序在浏览器中打开不在WebView中的Feed链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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