06-21-2023, 03:39 AM
(This post was last modified: 06-21-2023, 03:42 AM by Alexandre Machado.)
There are a few things that you are not considering.
When a mobile browser loads a page the first time, it checks for the "viewport" meta tag, so it will change the size (or scale) of the viewport accordingly.
If there is no viewport tag, it will use the default dimensions of the device. These are the sizes that you are reporting. I can guarantee you 200% that the values that you see is what the mobile browser is reporting as the "innerWidth" and "innerHeight". I have absolutely no doubt about this.
These numbers change later (when the Resize events run), because the viewport scaling may change when the layout is applied.
But wait, it gets worse: The sizes reported are different depending on the browser. I believe you are using some browser based on WebKit (Chrome and others). Firefox reports it differently (the same values that you would expect using a desktop browser).
To complete the mess, the resize event don't use the browser viewport sizes, but the scroll sizes, which may be different, especially in WebKit mobile browsers. Again, in Firefox they are very likely to be the same.
If you need to have the exact size of the viewport you need to use the OnResize event which will give you the correct sizes *after* the layout has been applied
Side note:
The IW code loader currently doesn't use a viewport tag, differently from the forms that will use whatever you specify in the server controller property. I'll change the code loader to use the view port tag, however it still won't give you the same result as the OnResize event, in WebKit browsers (possibly others) because of the reasons I explained above.
When a mobile browser loads a page the first time, it checks for the "viewport" meta tag, so it will change the size (or scale) of the viewport accordingly.
If there is no viewport tag, it will use the default dimensions of the device. These are the sizes that you are reporting. I can guarantee you 200% that the values that you see is what the mobile browser is reporting as the "innerWidth" and "innerHeight". I have absolutely no doubt about this.
These numbers change later (when the Resize events run), because the viewport scaling may change when the layout is applied.
But wait, it gets worse: The sizes reported are different depending on the browser. I believe you are using some browser based on WebKit (Chrome and others). Firefox reports it differently (the same values that you would expect using a desktop browser).
To complete the mess, the resize event don't use the browser viewport sizes, but the scroll sizes, which may be different, especially in WebKit mobile browsers. Again, in Firefox they are very likely to be the same.
If you need to have the exact size of the viewport you need to use the OnResize event which will give you the correct sizes *after* the layout has been applied
Side note:
The IW code loader currently doesn't use a viewport tag, differently from the forms that will use whatever you specify in the server controller property. I'll change the code loader to use the view port tag, however it still won't give you the same result as the OnResize event, in WebKit browsers (possibly others) because of the reasons I explained above.

