Skip to content

iOS下Safari浏览器返回上一个页面js不重新执行的问题 #12

Description

@HuarenYu

Safari从一个页面跳转到另一个页面再返回时js不会重新执行,因为Safari采用了 back-forward cache

解决方法如下:

window.onpageshow = function(event) {
    if (event.persisted) {
        window.location.reload() 
    }
};

参见stack overflow

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions