iOS Facebook App浏览器 - 强制链接在Safari中打开

iOS Facebook App浏览器 - 强制链接在Safari中打开

问题描述:

Facebook应用程序拥有自己的浏览器(使用UIWebView for iOS应用程序),但它有一些限制。我们需要网站上的某些链接,以确保在iOS上使用Safari进行查看。

The Facebook App has it's own browser (using the UIWebView for iOS apps) but it has a few limitations. We need certain links on our site to be sure to be viewed with Safari on iOS.

FB应用程序可以选择在Safari中手动打开链接,但是是否有自动执行此方式吗? IE浏览器。一些JS或特定参数在一个标签链接强制在Safari中打开。

The FB app has an option to manually open links in Safari, but is there a way to do this automatically? Ie. some JS or special parameter in the a tag link to force open in Safari.

可能没有办法自动化这个但是您应该可以检测到它并且更优雅地处理它。 Facebook添加一些额外的用户代理字符串,所以你可以嗅一些FB ..信息位:

There might not be a way to automate this but you should be able to detect it and handle it more gracefully. Facebook adds some extras to the User agent string so you could sniff for some of the FB.. info bits:

Mozilla/5.0 (iPad; U; CPU iPhone OS 5_1_1 like Mac OS X; en_US) AppleWebKit (KHTML, like Gecko) Mobile [FBAN/FBForIPhone;FBAV/4.1.1;FBBV/4110.0;FBDV/iPad2,1;FBMD/iPad;FBSN/iPhone OS;FBSV/5.1.1;FBSS/1; FBCR/;FBID/tablet;FBLC/en_US;FBSF/1.0]

似乎有一个href =http://mpulp.mobi/2012/01/funky-user-agent-on-facebook-iphone-app/ =nofollow>有些人试图弄清楚他们的意思,但是不管他们告诉你你在这个Facebook网页框架内。

There seems to be some people trying to figure out what they mean, but regardless they tell you that you're within that facebook web frame.

嗅探(js或后端)其中一个将允许您加载页面不同或在最少显示一个解释和说明,以在safari打开它。仍然不是自动的,但您至少可以检测到这种情况,并提供手册解决方案。

Sniffing (js or backend) for one of these would allow you to load the page differently or at least display an explanation and instructions to open it in safari. Still not automatic but you can at least detect the situation and have a documented manual solution.