iOS Facebook App browser - force link to open in Safari

前端 未结 2 660
梦毁少年i
梦毁少年i 2020-12-19 03:04

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

2条回答
  •  粉色の甜心
    2020-12-19 03:51

    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]
    

    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.

    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.

提交回复
热议问题