UIWebView content is wider on iOS 5 than on iOS 6

I have a UIWebView containing some HTML where the width and height containing the div are 100% . This works fine on iOS 6, where the div fills the UIWebView both portrait and landscape orientation. When I run it on iOS 5.1, it does not work. The width of the div looks like 100% of the iPad screen instead of the UIWebView . UIWebView allows a horizontal scrollbar and the content gets too wide.

What should I do to meet the needs of iOS 5 in this situation?

I tried to insert some viewport options as mentioned in the comments of iOS 5 and iOS 6 - the difference is in the behavior of the UIWebView , but it doesn't seem to make a difference.

+4
source share
1 answer

I was always worried about the behavior of pre-iOS-6, because by default UIWebView uses the screen size of the device, not the view frame. However, adding the following viewport meta viewport fixes the issue for me also on iOS 5. Try to download content only after the web view has the final frame.

 <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> 
0
source

Source: https://habr.com/ru/post/1493666/


All Articles