I am using JS to get the innerWidth and innerHeight of a webviewer. The onload function works fine but the onresize function is not triggered. I have tried the standard webviewer and also Sunny Gupta's excellent CustomWebview. The code works on a pc browser.
Does anyone know if this is possible on an android?
<pre>
<%--
<script>
window.onload = function myFunction() {
setTimeout(function(){
var w = window.innerWidth;
var h = window.innerHeight;
// alert("innerSize-"+h+"*"+w);
window.AppInventor.setWebViewString("innerSize-"+h+"*"+w);}, 800);
}
window.onresize=function myFunction2() {
var w = window.innerWidth;
var h = window.innerHeight;
var txt = "Window size: width=" + w + ", height=" + h;
//alert(txt);
window.AppInventor.setWebViewString("innerSize-"+h+"*"+w);
}
</script>
--%>
</pre>
Hi @TIMAI2 yes I got the width and height values using the webstring onload. If the window is resized the values change but the background images are still set to the onload values, hence I was trying to get new values when resized.
the second page is used for editing the colours of the holds. When editing it is necessary to zoom to make the holds bigger so that chunky fingers can click onto them, hence the resize. In theory I could only have background images on the static page and disallow zoom and have no background images on the edit page.
another thing I have noticed was that when I tried to resize the image using the chrome browser (on a mobile) it only very occasionally triggers the alert, something is amiss. sample