Make back button detect if you have the page open in the background

This commit is contained in:
Reimar 2025-08-06 18:30:19 +02:00
parent 278abb1f8f
commit 6566da2571
Signed by: Reimar
GPG Key ID: 93549FA07F0AE268
2 changed files with 7 additions and 2 deletions

View File

@ -20,7 +20,7 @@
to add this <span class="type"></span> to your bookmarks. to add this <span class="type"></span> to your bookmarks.
</p> </p>
<p>Next time you open the bookmark, the <span class="type"></span> will automatically be opened.</p> <p>Next time you open the bookmark, the <span class="type"></span> will automatically be opened.</p>
<a href="/">Back</a> &nbsp; <a id="open-popup" href="javascript:void(0);">Open Popup Now</a> <a id="back" href="javascript:void(0);">Back</a> &nbsp; <a id="open-popup" href="javascript:void(0);">Open Popup Now</a>
</body> </body>
</html> </html>

View File

@ -14,13 +14,18 @@ if (navigator.platform.match(/Mac/i)) {
}); });
document.getElementById("open-popup").onclick = function() { document.getElementById("open-popup").onclick = function() {
window.open( window.open(
popupLink, popupLink,
"PopupTimer" + Date.now(), "PopupTimer" + Date.now(),
"width=250,height=100,menubar=no,toolbar=no,location=no,status=no,resizable=no,scrollbars=no" "width=250,height=100,menubar=no,toolbar=no,location=no,status=no,resizable=no,scrollbars=no"
); );
}
document.getElementById("back").onclick = function() {
if (window.opener)
window.close();
else
location.href = "/";
} }
function parseQueryParams() { function parseQueryParams() {