Forums » Privacy Browser Android Forum »
Zooming out affects viewport in some pages
Added by ask low about 1 year ago
Take the example of android dev page.
https://developer.android.com/training/multiscreen/screendensities#dips-pels
This happens on many other websites too. When page loads, it is in right viewport. But the moment you try to zoom out the page, eveything shrinks and there's a huge padding on the right part of the page.
I know this must be the page issue. This happens nonethless of disabling/enabling of wide viewport / javascript / changing useragent / desktop & landscape mode.
Can this be considered an issue ? If so, is this fixable by browsing point of view ? Or is this the issue of webview / webpage itself ?
initial load.png (336 KB) initial load.png | |||
after zoom out.png (329 KB) after zoom out.png |
Replies (21)
RE: Zooming out affects viewport in some pages - Added by Soren Stoutner about 1 year ago
WebView is just displaying the HTML as it is sent to it by the server. In this case, the HTML specifies what the page width is. Websites don't have to do this, but they can if they choose.
For the URL you linked to above, enabling JavaScript resolves the problem. Probably because the webpage is using JavaScript to detect the screen width and then modifies the HTML setting to match.
Different things will work for different websites, and for some of them nothing will work (short of convincing the web developer to write better HTML).
RE: Zooming out affects viewport in some pages - Added by Soren Stoutner about 1 year ago
Along these lines, there are some plans with Privacy WebView in the 4.x series to ignore or change some HTML to improve the user experience. For example, Feature #784: Allow pinch-to-zoom on webpages that want to prohibit it.
RE: Zooming out affects viewport in some pages - Added by ask low about 1 year ago
Strange because js didn't fix the padding here. Which means the android dev page is written and destined to behave like this.
RE: Zooming out affects viewport in some pages - Added by Soren Stoutner about 1 year ago
Which version of WebView are you using?
RE: Zooming out affects viewport in some pages - Added by ask low about 1 year ago
Mulch System Webview v119.0.6045.163
https://divestos.org/apks/official/fdroid/repo?appId=us.spotco.mulch_wv
EDIT: Oh, just disabled js and the site took couple seconds of time and reloaded itself. Now it fits into the screen btw.
RE: Zooming out affects viewport in some pages - Added by Soren Stoutner about 1 year ago
Here is a video of how it works on my device (the link will expire after about a month). First, you can see it has a large page width with JavaScript disabled. Then, enabling JavaScript, the page width matches the device.
RE: Zooming out affects viewport in some pages - Added by ask low about 1 year ago
Can you look into github issues with js on ?
https://github.com/TeamNewPipe/NewPipe/issues/9764
It's reverse here. Site looks fine without js, but introduces padding with js. You have to be signed in from your github account btw. Unsigned session has no padding again.
RE: Zooming out affects viewport in some pages - Added by Soren Stoutner about 1 year ago
Yeah, JavaScript can be used to make the layout worse just like it can be used to make the layout better. It all depends what the JavaScript does that was written by the web developer.
Ultimately, short of editing the HTML and CSS and JavaScript it is given, all WebView can do is follow the instructions the webpage sends it.
RE: Zooming out affects viewport in some pages - Added by ask low about 1 year ago
I've tested these set of buggy pages around other browsers. And they have same issues there either. It's very unfortunate that even larger corpo pages like these, are mobile browser unfriendly.
RE: Zooming out affects viewport in some pages - Added by Soren Stoutner about 1 year ago
I should note that GitHub lays out fine for me either way (JavaScript enabled or disabled). What User Agent are you using?
RE: Zooming out affects viewport in some pages - Added by ask low about 1 year ago
Bydefault it's set to Chrome on Android. Although changing to any haven't solved this padding issue. I believe it's not UA specific bug. I think it's webpages that are rogue by themselves.
EDIT: Might it be related to dpi ?
Okay leave it. I'm considering using their android app. GitHub don't have ads in their app, as well as it's fast and better UI with readable fonts.
RE: Zooming out affects viewport in some pages - Added by Soren Stoutner about 1 year ago
Some webpages send different versions based on the User Agent. So, changing the User Agent won't change things for some webpages, but it does for others.
https://www.stoutner.com/user-agent-problems/
Beyond that, you are using a custom WebView. Some of them send report a page width larger than the actual device as an anti-fingerprinting tactic. So, you might want to try a standard WebView from the AOSP to see if that makes a difference.
RE: Zooming out affects viewport in some pages - Added by ask low about 1 year ago
I actually changed Webview to native android too. Tested it even on vanadium. I think it must be some form of dpi issue. Caz switching to landscape mode (which achieves desktop layout), fixes this issue.
RE: Zooming out affects viewport in some pages - Added by Soren Stoutner about 1 year ago
As I remember, the OS you are using lies to the system about how much memory it has and some other physical specs. Perhaps it also lies to the WebView about what the screen dimensions are.
RE: Zooming out affects viewport in some pages - Added by ask low about 1 year ago
Your very own website created padding around right half because of the git clone command.
https://www.stoutner.com/privacy-browser-android/
If that single line command got wrapped to a mobile view, then the whole website would also play nice as well.
RE: Zooming out affects viewport in some pages - Added by Soren Stoutner almost 1 year ago
Thanks for pointing that out. It should be fixed now.
RE: Zooming out affects viewport in some pages - Added by ask low almost 1 year ago
Sure. But I think you maintain lot of blogs don't you. I believe some of them have the same issues. And fixing all of them isn't tedious?
RE: Zooming out affects viewport in some pages - Added by Soren Stoutner almost 1 year ago
Actually, I went through and fixed a quite a few pages after you pointed that out to me. That is part of what it means to be a webmaster.
RE: Zooming out affects viewport in some pages - Added by Soren Stoutner almost 1 year ago
Actually, I went through and fixed a quite a few pages after you pointed that out to me. That is part of what it means to be a webmaster.
RE: Zooming out affects viewport in some pages - Added by ask low 10 months ago
Some text here affect padding too
https://www.stoutner.com/the-x-requested-with-header/
RE: Zooming out affects viewport in some pages - Added by Soren Stoutner 10 months ago
That's fine. I would consider that the correct behavior for that text. It was specifically specified as preformatted and the browser should not introduce line breaks.