WKWebViewTips
WKWebViewTips copied to clipboard
WKWebview Content not fitting properly on device orientation
I have to load html content in wkwebview. I have added viewport and width=device-width,user-scalable=no. Initially the content loads properly in portrait mode, but when device is rotated to landscape and then back to portrait, the content overflows and does not fit to the device width. I dont need horizontal scrolling so I have disabled horizontal scroll of webview. Also I have reloaded web view on device orientation. Any help would be appreciated.
Try this line of code
Its supposed to make your webpage or app compatible with all devices.
@Aby-117 cant see your code. Can you post again
I posted the code it somehow was not appearing
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"/>
Now you'll be able to see it, its been a long time since I've done HTML and CSS but there are lots of bootstraps that can make your programmes compatible with other devices.
What are you making and what languages have you used to make it, if you wouldn't mind me asking?
Did it work?
I am working on Visual Studio with C#. I have wkwebview in mobile application and have to load html content in it. How do I use bootstrap in mobile application?
Like this...
not working
Maybe there is an error somewhere in your code... Just double check to make sure there nothing wrong with the lines of code you've written or check out the latest bootstrap links if that's not the case.
Actually the html which I get from server is not responsive, as in it has fixed width. So on mobile device rotation, the width expands and when I rotate again to set in portrait mode, the html content overflows. So any suggestion for how to fix this?
Also, I am developing iOS application so in that while rendering html in webview, I am facing problem.
I might recommend you to change fixed width into liquid width so that it can work for all devices and also in portrait mode. If the HTML code you've used is for fixed width than the code itself is self-explanatory, it says "fixed" which means it's going to stay the same use liquid width I think it might make a difference. I think webview has autofill framework codes as well but I don't really use webview so I don't know a lot about it.