2

As the title suggests, I was wondering if there is a way to force SFSafariViewController to load the desktop version of a website.

Thanks

Antonio Giarrusso
  • 810
  • 1
  • 9
  • 19
  • check this .. add this in your request... [request setValue:[NSString stringWithFormat:@"%@ Safari/528.16", [request valueForHTTPHeaderField:@"User-Agent"]] forHTTPHeaderField:@"User_Agent"]; http://stackoverflow.com/a/6065794/2714702 – Vizllx Feb 01 '16 at 12:13
  • Thanks for your comment, but there is no way to set a NSURLRequest on SFSafariViewController... your solution works only for a UIWebView. https://developer.apple.com/library/ios/documentation/SafariServices/Reference/SFSafariViewController_Ref/ – Antonio Giarrusso Feb 01 '16 at 12:28

2 Answers2

1

As of iOS 9, sadly no. Your best bet might be to create your own web view and use a different user agent as @vizllx suggests in the comments.

Stephen Darlington
  • 51,577
  • 12
  • 107
  • 152
1

You can use WKWebView and then set the customUserAgent property of the web view to any desktop browser user-agent.

Pradeep K
  • 3,671
  • 1
  • 11
  • 15
  • 1
    If you have control over the website then you can pass a param in the url to load the desktop site instead – Pradeep K Feb 01 '16 at 13:48