Last active
August 2, 2020 09:36
-
-
Save iceener/4649533ee1087c4abe8b490e0e875c45 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Focused tab | |
const isBrowserTabFocused = () => !document.hidden; | |
isBrowserTabFocused(); | |
// Redirect to... | |
const redirect = (url, replace = false) => { | |
if (asLink) { | |
window.location.href = url; | |
} | |
window.location.replace(url); | |
}; | |
redirect('https://google.com'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment