HTML5 has a pageshow event. In what instances does it work differently than the body's onload
handler?
Asked
Active
Viewed 3,482 times
4

Brian Tompsett - 汤莱恩
- 5,753
- 72
- 57
- 129

Ben McCann
- 18,548
- 25
- 83
- 101
2 Answers
3
The pageshow event fires every time the page is loaded whereas the load event doesn’t fire in Firefox 1.5 when the page is loaded from cache.

Ben McCann
- 18,548
- 25
- 83
- 101
-1
In addition to the answer above, there is a far more important difference between the two.
According to my test on iOS, if you load a local page from a WkWebView
, hit a link to jump to another page and use the goBack
function to go back the previous page, only onpageshow
will fire, onload
will not.

Earth Engine
- 10,048
- 5
- 48
- 78
-
The page is loaded from cache when you go back, so you are not describing any difference. – Géry Ogam Jun 08 '21 at 22:21