Webviewer onresize

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>

If webview string method is not working for some reasons then you can always try alert method.
I'll check why it is not working.

unfortunately the alert doesn't trigger either

I thought the idea was to get the w and h from the app and not through the webviewer?

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.

Why are you resizing it, having gone to all the trouble to get the size needed and apply it ?

there are two pages one is static which will show different colours for the the chosen holds (see the image on https://community.appinventor.mit.edu/t/varying-background-image-and-window-innerheight-and-widths/39275/2

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