Project

General

Profile

Zooming out affects viewport in some pages

Added by ask low 6 months 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 ?


Replies (21)

RE: Zooming out affects viewport in some pages - Added by Soren Stoutner 6 months 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 6 months 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 6 months 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 6 months ago

Which version of WebView are you using?

RE: Zooming out affects viewport in some pages - Added by ask low 6 months 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 6 months 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.

https://nextcloud.stoutner.com/s/FAWmjFPqBKMB9Ni

RE: Zooming out affects viewport in some pages - Added by ask low 6 months 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 6 months 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 6 months 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 6 months 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 6 months 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 6 months 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 6 months 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 6 months 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 6 months 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 6 months ago

Thanks for pointing that out. It should be fixed now.

RE: Zooming out affects viewport in some pages - Added by ask low 6 months 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 6 months 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 6 months 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 4 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.

    (1-21/21)