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 pageshowpagehide, được kích hoạt khi một tài liệu đang được tải hoặc dỡ tải.

Event PageTransitionEvent

Hàm khởi tạo

PageTransitionEvent()

Tạo một đối tượng PageTransitionEvent mớ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.persisted Read 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

Tương thích trình duyệt

Xem thêm