iOS Question How to get WebView zoom level

StephanP82

Member
Licensed User
Longtime User
The WebView shows a html-based table like a month calendar. With a right oder left swipe the user can go to the next or the previos month. But if the WebView is zoomed by the user, it should move the zoomed view and not change the month. So I need the information wether the WebView is currently zoomed to prevent the month change.
 
Upvote 0

StephanP82

Member
Licensed User
Longtime User
I've used it because I need merged cells and the possibility to zoom. As far as I know FlexibleTable or B4XTable dont support these features.

In B4i I can set the zoom level by:
B4X:
Webview.EvaluateJavaScript("document.body.style.zoom = 2.0")

What I need is to GET the current zoom level. Is it possible to use EvaluateJavaScript to get it?
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
What I need is to GET the current zoom level

Did you try to check scrollview properties ?

B4X:
Dim no As NativeObject
no = webView1
Log ("zoomScale = " & no.GetField ("scrollView").GetField ("zoomScale").AsNumber)

This works at least in combination with meta name=viewport ... in header.
 
Last edited:
Upvote 0
Top