PageTransitionEvent
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Đối tượng sự kiện PageTransitionEvent có sẵn bên trong các hàm xử lý cho các sự kiện pageshow và pagehide, được kích hoạt khi một tài liệu đang được tải hoặc dỡ tải.
Hàm khởi tạo
PageTransitionEvent()-
Tạo một đối tượng
PageTransitionEventmới.
Thuộc tính phiên bản
Giao diện này cũng kế thừa các thuộc tính từ lớp cha, Event.
PageTransitionEvent.persistedRead only-
Chỉ ra nếu tài liệu đang được tải từ bộ nhớ cache.
Ví dụ
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");
}
});
Thông số kỹ thuật
| Specification |
|---|
| HTML> # the-pagetransitionevent-interface> |