(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="" 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('');
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.
(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." 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.');
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.
Share Improve this question asked Apr 3, 2014 at 17:21 thplthpl 5,9103 gold badges30 silver badges44 bronze badges 1- There is a trick actually, see this: stackoverflow./questions/53025910/… – Goon Nguyen Commented Oct 29, 2018 at 8:03
1 Answer
Reset to default 5This 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
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744310441a4567920.html
评论列表(0条)