Created
July 1, 2022 11:45
-
-
Save desprit/c9704d4f758e911f0ac58ccd665b73fc to your computer and use it in GitHub Desktop.
Never ever do this on your website
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var titleValue = document.title; | |
var hidden = "hidden"; | |
function onchange() { | |
document.title = document.hidden ? "Pssst! We’re Still Here…" : titleValue; | |
} | |
if (hidden in document) { | |
document.addEventListener("visibilitychange", onchange, false); | |
} | |
else if ((hidden = "mozHidden") in document) { | |
document.addEventListener("mozvisibilitychange", onchange, false); | |
} | |
else if ((hidden = "webkitHidden") in document) { | |
document.addEventListener("webkitvisibilitychange", onchange, false); | |
} | |
else if ((hidden = "msHidden") in document) { | |
document.addEventListener("msvisibilitychange", onchange, false); | |
} | |
// IE 9 and lower: | |
else if ("onfocusin" in document) { | |
document.onfocusin = document.onfocusout = onchange; | |
} | |
else | |
window.onpageshow = window.onpagehide | |
= window.onfocus = window.onblur = onchange; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copied from Sarova hotel engine.
https://bookings.sarova.com/rates-room
When you go away from the Sarova tab, the <title> changes to
Pssst! We’re Still Here…
. And instead of having a clear title, you get this weird shit.