Reputation: 2815
I'm making an app where having a UIWebView
is absolutely necessary. However, I'm having a problem where the UIWebView
doesn't load the mobile version of the website.
I've read some questions on StackOverflow, and they all seem to say it's up to the website to decide what type to display, and that the UIWebView
acts just like Safari
.
However, I have tested with 9 different links to different websites and they all load the desktop version in my UIWebView
and the mobile version in Safari
.
What could I do to force the UIWebView
to load the mobile version just like Safari
does? Are there a type of headers I could send or cookies to set or anything that actually works?
Furthermore, the desktop versions scale terribly in my UIWebView
. They do allow zooming, but when I release they all (the websites) reset back to the same position. And when I try to scroll horizontally, they just snap back into the original position, which leaves the website impossible to read and my UIWebView
utterly useless. If I can't force the mobile page, how can I make the desktop versions act differently?
Upvotes: 3
Views: 1378
Reputation: 2815
I forgot to set the constraints for the UIWebView
, which caused the content to be rendered wrongly. I don't know how that's relevant, but constraining the UIWebView
seems to not only render the content correctly but also display the mobile site.
Upvotes: 2