We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

这篇翻译不完整。请帮忙从英语翻译这篇文章

Page transition events fire when a webpage is being loaded or unloaded.

当网页在加载完成或卸载后会触发页面传输事件(Page transition events)。

DOM Information

 

Inheritance Hierarchy

 Event
   PageTransitionEvent

Example

HTML

<!DOCTYPE html>
<html>
<body onpageshow="myFunction(event)">
</body>
</html>

JavaScript

function myFunction(event) { 
    if (event.persisted) {
        alert("The page was cached by the browser");
    } else {
        alert("The page was NOT cached by the browser");
    }
}

Members

The PageTransitionEvent object has these types of members:

Properties

The PageTransitionEvent object has these properties.

Property Access type Description

persisted

只读

标记页面是否从缓存(Backforward Cache)中加载

 

文档标签和贡献者

此页面的贡献者: Chandler0415, acelan86
最后编辑者: Chandler0415,