Volla & Volla 22, WebView problem and irony of ironies

Ok, as recorded: WebView produces incorrect screen.height, window.innerHeight values - #14 by flypig

@flypig found a solution which works. The question is why would the issue appear at all?!

For anyone who comes to this because of scaling issues, the simplest solution is to specify it in the view:

     WebView {
         Component.onCompleted: {
             WebEngineSettings.setPreference("security.fileuri.strict_origin_policy", false, WebEngineSettings.BoolPref)
             WebEngineSettings.pixelRatio = 3
         }

as pointed out by @flypig.

1 Like

Be aware that this value is device-specific though, so while a value of 3 may work on one type of device, it may not be appropriate for another.

1 Like

Can you recall which apps you saw this in? In any case, @flypig had another suggestion which also solves the issue. It turns out that using a backup of files from .local/share where the app in question has a PREFS_WRITTEN file, this can lead to the the prefs.js file of the webview being incorrectly initialized.

In the case of harbour-tidings (where I just recently added a new WebView to replace the old QtWebkit) I only had to remove that prefs file and the .cache entries to get a proper prefs.js generated. The other data (the important bits) in .local/share remained unaffected. Some apps, however, removing the .cache entries will lose previous settings. Explicitly:

# rm .local/share/de.poetaster/harbour-tidings/__PREFS_WRITTEN__ 
# rm -rf .cache/de.poetaster/harbour-tidings/.mozilla

Got Tidings creating proper WebViews on the volla and GS5.

2 Likes

It was in Hafenschau

On an xperia x compact the mail client shows the same behavior ( at least on one phone)

where can i change the webview settings? in about:config?

For me it looks like qml
but clicking on the link suggests ~/.cache/org.myorg/webview-screensize/.mozilla/prefs.js

Removing the prefs-written file and the .Mozilla directory (obviously in the right app folders under .local and .cache) also fixes the problem for Kactus as well. It now displays news pages in mobile rather than desktop format and it scrolls properly.

1 Like

the prefs.js file resides in ~/.cache/ in the apps .mozilla directory. Be aware you can’t count on those changes being permanent.