0

I'm creating a UIWebView on iPad in a modal that has been resized. I checked the frame of the UIWebview and it's the right size. However, when I go to http://www.screenresolution.org, it still says it's 1024x768.

I don't want to use scalesPageToFit, I just want to be able to change the resolution which UIWebView reports to the website so the webpage renders correctly.

For example, when it's trying to show Google, this is what is shown: enter image description here

But this is what it would show if it reported the resolution correctly: enter image description here

codenamepenryn
  • 451
  • 1
  • 7
  • 18
  • You mention that you checked the frame of the UIWebview and that it's the right size. I don't believe your issue is with the UIWebview, but likely with the website you are viewing in your view. Typically, a well built website is designed in such a way that it will scale properly in the viewport. Furthermore, I wouldn't rely on the information provided by that website as it doesn't appear to be entirely correct. Can you elaborate a little more on the issue that you are having with your UIWebview? What exactly is the problem with the webpage? Does it happen with, say, www.google.com? – Jeremy Feb 07 '14 at 21:29
  • So, I'm presenting a UIWebView in a modal that has been resized, and when I go to www.screenresolution.org within that modal, it's saying that the UIWebView's screen resolution is 1024x768 and not UIWebView's actual resolution. – codenamepenryn Feb 07 '14 at 21:33
  • Well, what is being reported by the website isn't correct, which discredits the site. I wouldn't spend the energy trying to get it to report what you want it to as you may never achieve it. Is this a preemptive move in order to hopefully get sites to work properly in your view, or have you noticed a problem with a particular website? If so, maybe expand on that and perhaps some of the great minds in stackoverflow can help more easily. – Jeremy Feb 07 '14 at 21:36
  • Yeah, no websites show correctly because of the resolution is reported wrong. For example Google think's the resolution is 1024x768 but since the resolution is actually a lot smaller, only part of Google is shown. – codenamepenryn Feb 07 '14 at 21:39
  • Since the website I'm trying to load is responsive, it's showing the wrong view since the reported resolution is wrong. – codenamepenryn Feb 07 '14 at 21:42
  • If you set `scalesPageToFit` to **YES**, does the page then scale properly? – Jeremy Feb 07 '14 at 21:44
  • I might suggest these posts as this appears to be a scaling issue: [UIWebView does not scale content to fit](http://stackoverflow.com/questions/1511707/uiwebview-does-not-scale-content-to-fit) and [HTML Content fit in UIWebview without zooming out](http://stackoverflow.com/questions/10666484/html-content-fit-in-uiwebview-without-zooming-out). – Jeremy Feb 07 '14 at 21:49
  • `scalesPageToFit` doesn't work. – codenamepenryn Feb 07 '14 at 21:53
  • Check out those posts I've mentioned above and feel free to report back. I'd be interested to know how it goes. – Jeremy Feb 07 '14 at 21:55
  • This solution doesn't work: http://stackoverflow.com/questions/10666484/html-content-fit-in-uiwebview-without-zooming-out But now it shows a zoomed out version of desktop Google instead of the small screen version of Google. – codenamepenryn Feb 07 '14 at 22:22

0 Answers0