A local two-page browser playground for observing page lifecycle events and back-forward cache signals. Navigate between the pages and inspect the event timeline, including the persisted flag on pageshow and pagehide.
- 👁️ Tracks visibilitychange and the current document visibility state.
- 🔁 Logs pageshow and pagehide with their persisted values.
- 🧊 Listens for freeze and resume where the browser supports them.
- 🧪 Provides a same-origin navigation flow for trying Back and restoration.
Run the local server, open the first page, navigate to the second, and return with Back. Browser event ordering and BFCache decisions vary by browser.
npm startOpen http://127.0.0.1:4175.
- Node.js 18+ — dependency-free local static server.
- Browser JavaScript — Page Visibility and page lifecycle events.
- License — MIT
browser-page-lifecycle-lab/
├── public/
│ ├── assets/mark.svg
│ ├── app.js
│ ├── index.html
│ ├── second.html
│ ├── second.js
│ └── styles.css
├── .gitignore
├── LICENSE
├── package.json
├── README.md
└── server.js
- Add a browser compatibility matrix.
- Add an optional event export to JSON.
- Add a controlled test for BFCache restoration behavior.
Issues and pull requests are welcome. Keep the demo local and describe browser-specific behavior accurately.
Released under the MIT License.