1. Page is loaded in portrait mode
2. User follows a link to another page
3. User rotates the iPhone while viewing the other page
4. User uses the back button in Safari
When the page is redrawn, neither the onload or onorientation handlers
will fire.
Has anyone solved this problem without using setInterval to poll?
Thanks,
Sean
Just double-check the onresize events, because you are going to get
them as well when the content of the window grows in the Y axis.
--Jorge.
Thanks, Jorge!
I compared your working solution with my test page, line-by-line and found that by simply adding an onunload handler the load event is called properly in the problematic use case (returning to a previously loaded page, via the back button, after rotating the phone while viewing another page)
The unload handler can be an empty function, but simply by being registered it seems to correct the behavior of onload.
I'll check in the changes to samples/orient.html once Google Code finishes its maintenance.
Also, I did not see w.innerWidth with a value of 240 in portrait mode. Did that only happen when you removed window.onunload?