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.

PageTransitionEvent イベントオブジェクトは、文書が読み込まれるか、または終了する際に発行される pageshow および pagehide イベントのハンドラー内で使用できます。

Event PageTransitionEvent

コンストラクター

PageTransitionEvent()

新しい PageTransitionEvent オブジェクトを生成します。

インスタンスプロパティ

このインターフェイスには、親である Event から継承したプロパティもあります。

PageTransitionEvent.persisted 読取専用

キャッシュから読み込んでいる文書であるかどうかを示します。

HTML

html
<!doctype html>
<html lang="ja">
  <body></body>
</html>

JavaScript

js
window.addEventListener("pageshow", (event) => {
  if (event.persisted) {
    alert("このページはブラウザーがキャッシュしたものです");
  } else {
    alert("このページはブラウザーがキャッシュしたものではありません");
  }
});

仕様書

Specification
HTML
# the-pagetransitionevent-interface

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
PageTransitionEvent
PageTransitionEvent() constructor
persisted

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報