iOS Safari Mobile doesn't trigger pageshow firing only once

前端 未结 3 463
离开以前
离开以前 2021-01-14 07:09

The iOS Safari doesnt\'t seem to trigger pageshow event in the following situation.

Lets say I have 3 pages

  • Page A : (has some code code on pageshow ev
3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-14 07:53

    Try using:

    window.onpageshow = function(event) {
    if (!event.persisted) {
        alert("hello");
    }
    };
    

    Persisted is false on initial page load, so you can check against it, and if it false, it is your first page load.

提交回复
热议问题