From 95c378fab5c1d2db99986fb25b79a81c636c998f Mon Sep 17 00:00:00 2001 From: Tommy Steimel Date: Fri, 27 Oct 2023 09:40:53 -0700 Subject: [PATCH] use pagehide --- autopip.html | 2 +- document-pip/video.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/autopip.html b/autopip.html index d01853e..d111c1c 100644 --- a/autopip.html +++ b/autopip.html @@ -45,7 +45,7 @@  if (pipType == "document") {    pipWindow = await documentPictureInPicture.requestWindow({width: 400, height: 400});    pipWindow.document.body.append(video); -    pipWindow.addEventListener('unload', _ => { +    pipWindow.addEventListener('pagehide', _ => {      videoContainer.append(video);      pipWindow = null;    }); diff --git a/document-pip/video.html b/document-pip/video.html index 55608ed..0f0e0ad 100644 --- a/document-pip/video.html +++ b/document-pip/video.html @@ -58,7 +58,7 @@ onPipClosing(pipWindow); } pipWindow = newPipWindow; - pipWindow.addEventListener('unload', onPipClosing.bind(null, pipWindow)); + pipWindow.addEventListener('pagehide', onPipClosing.bind(null, pipWindow)); btnClosePip.removeAttribute('disabled'); let pipDocument = pipWindow.document; pipDocument.body.append(divContent);