Posts: 145
Threads: 28
Joined: May 2018
Reputation:
12
Location: Netherlands
Hi Alexandre,
The source code for this version doesn't seem published. Can you have a look?
Posts: 2,264
Threads: 197
Joined: Mar 2018
Reputation:
86
Location: Auckland, New Zealand
06-20-2023, 09:21 PM
(This post was last modified: 06-20-2023, 09:21 PM by Alexandre Machado.)
Yes, it is resolved.
You are not considering the Device Pixel Ratio (DPR) of the mobile device which depends on the device. DPR values between 2 and 3 are typical and it seems to be your case.
And there is absolute no way for the IW application server to have access to any browser functionality from the machine where it is running.
Posts: 105
Threads: 33
Joined: Jun 2019
Reputation:
0
Location: Canada
I am sure that it is not related to the device DPR!
Because as I was explaining in the original thread, the dimensions were right for the onAsybcResize and onAsyncOrientationChange!
The dimensions were wrong only for the onRender event!
And it is still the case!
If you run the demo I posted before, you will see that the correct available browser dimensions are displayed for the onAsyncResize and onAsyncOrientationChange!
And those dimensions can be retrieved correctly from any event using the JavaScript code below:
var available_width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var available_height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
Posts: 2,264
Threads: 197
Joined: Mar 2018
Reputation:
86
Location: Auckland, New Zealand
06-21-2023, 12:26 AM
(This post was last modified: 06-21-2023, 12:45 AM by Alexandre Machado.)
That's exactly what IW uses to retrieve the browser dimensions. I doubt very much that any device built in the last 10 years will report anything like 640 x 360.
For instance, a Samsung Galaxy 3, released in 2012 has a screen size in pixels = 720×1280. However it doesn't mean that these are going to be the reported dimensions.
BTW, are you using any viewport tag on your page?
Posts: 105
Threads: 33
Joined: Jun 2019
Reputation:
0
Location: Canada
The device I am using for test for Android OS is a Samsung J7! it is old but enough for test.
And the dimensions returned by the posted JavaScript code are exactly what I told you.
You can try on your side and you will see.
There is no viewport tag added on the demo. It is the same simple demo I posted on the thread.
Posts: 2,264
Threads: 197
Joined: Mar 2018
Reputation:
86
Location: Auckland, New Zealand
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.
Posts: 2,264
Threads: 197
Joined: Mar 2018
Reputation:
86
Location: Auckland, New Zealand
06-21-2023, 06:37 AM
(This post was last modified: 06-21-2023, 06:38 AM by Alexandre Machado.)
We are building a new release that may suit your needs. I'm changing the page loader code to take in account these factors.
Please hold on