In my app I am displaying website using the WKWebView
component but since the website has <iframe>
content, scrolling does not work. The iframe content itself registers taps and swipes but it never scrolls.
When I open the same page with Safari it works well, I can interact with iframe's content and scroll without any issues.
My iframe takes full width and height of the webpage and I added this property:
-webkit-overflow-scrolling: touch;
But it does not help. Unfortunately I cannot show the webpage in question because it contains proprietary data and is behing login screen.
I would prefer to solve this without having to modify the webpage, since Safari works fine.
EDIT: It looks like the iframe
might be detecting the events and not "forwarding" them, because when there is also for example navbar on the page (that is not part of the iframe
) I can swipe it and scroll. However since there is very little space on the screen, I would prefer not to have any other elements apart from iframe
itself.
EDIT 2: I tried to display the page from iframe
directly in the WKWebView
but it still does not scroll at all. Works great in Safari.
Solution: In the end I solved the issue by changing the userAgent
property of the WKWebView
to match either iOS 12 Safari for iPhone or iPad depending on the device. The website in question is fairly complex regarding user interaction so I guess they were sending "incorrect" settings to the browser with the default user agent.