Created
September 24, 2019 04:05
-
-
Save parzibyte/9bfe9a42553889de8cb7d4439ffe1d8d to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html lang="es"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Ejemplo de cambio de título</title> | |
<script> | |
var tituloOriginal = document.title; // Lo guardamos para restablecerlo más tarde | |
window.onblur = function(){ // Si el usuario se va a otro lado... | |
document.title = "Hey, vuelve aquí";// Cambiamos el título | |
} | |
window.onfocus = function(){ | |
document.title = tituloOriginal; // Si el usuario vuelve restablecemos el título | |
} | |
</script> | |
</head> | |
<body> | |
<h1>Si te vas a otra pestaña, el título cambia</h1> | |
<a href="https://parzibyte.me/blog">parzibyte.me/blog</a> | |
<p> | |
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odio nihil facilis natus earum repellat libero saepe, quasi amet cupiditate tenetur molestias error pariatur, quisquam velit odit suscipit quos accusantium et. | |
</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment