PageTransitionEvent
PageTransitionEvent 事件物件可在處理 pageshow 和 pagehide 事件的處理函式中使用,這些事件在文件正在載入或解除安裝時觸發。
建構函式
PageTransitionEvent()-
建立一個新的
PageTransitionEvent物件。
例項屬性
此介面還繼承了其父級 Event 的屬性。
PageTransitionEvent.persisted只讀-
表示文件是否從快取中載入。
示例
HTML
html
<!doctype html>
<html lang="en-US">
<body></body>
</html>
JavaScript
js
window.addEventListener("pageshow", (event) => {
if (event.persisted) {
alert("The page was cached by the browser");
} else {
alert("The page was NOT cached by the browser");
}
});
規範
| 規範 |
|---|
| HTML # the-pagetransitionevent-interface |
瀏覽器相容性
載入中…