0

I'm trying to load this page in a UIWebView:

http://www.usopenofsurfing.com/on-demand/dvr

It works using Flash on a desktop browser, but has a different implementation when it detects iOS. It works just fine on Mobile Safari, but it's not working in the UIWebView.

Any idea why?

I've looked at the reported User Agents between actual Mobile Safari and the UIWebView.

UIWebView: iPad; CPU OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9B206
Safari: iPad; CPU OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3

The javascript which is switching between the flash and the iOS functionality simply looks for the strings ipad, iphone, or ipod:

var deviceAgent = navigator.userAgent.toLowerCase();
var is_iOS = deviceAgent.match(/(iphone|ipod|ipad)/);

So the User Agent should only come into play when choosing between Flash and iOS and that appears to be done properly.

Rishil Patel
  • 1,977
  • 3
  • 14
  • 30
Kenny Wyland
  • 20,844
  • 26
  • 117
  • 229
  • Try it with a faked user-agent that resembles mobile Safari. – Till Aug 24 '12 at 19:39
  • How can I have my UIWebView fake a different user agent string? – Kenny Wyland Aug 24 '12 at 19:51
  • See http://stackoverflow.com/questions/478387/change-user-agent-in-uiwebview-iphone-sdk – Till Aug 24 '12 at 19:55
  • Thanks. I followed the instructions and I verified the user agent was different via the server logs. The problem still exists (not surprising, because the User-Agent was being detected correctly even before this). I have a feeling there is a feature difference between Safaria and UIWebView. – Kenny Wyland Aug 24 '12 at 20:22
  • hi did you get any solution for above problem. i am also facing same problem – Muralikrishna Mar 20 '17 at 13:17

1 Answers1

0

Cookies may be the problem here.

To the best of my understanding, Cookies can not be sent with the first request from a Webview, but can be sent with subsequent requests to the same URL, if and only if, the first request was successful.

This causes problems with authentication services that require cookies to authenticate on the first request to the URL.

Also see this stack article and this apple documentation.

Community
  • 1
  • 1
BishopZ
  • 6,269
  • 8
  • 45
  • 58