Source code

Revision control

Copy as Markdown

Other Tools

<body>
This page opens an alert box when the page is hidden.
<script>
document.addEventListener("visibilitychange", () => {
if (document.hidden) {
alert("You hid my page!");
}
});
</script>
</body>