Segue abaixo o código fonte de exemplo que apresentei em meu vídeo sobre Como Redirecionar o Usuário Para Outra Página via JavaScript, no YouTube.
Last active
February 23, 2022 14:22
-
-
Save UlyssesAlves/103d41a40f30437d3bdab33cc2d13400 to your computer and use it in GitHub Desktop.
Como Redirecionar o Usuário Para Outra Página via JavaScript
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
<html> | |
<head> | |
<title>Redirecionamento de Página via JavaScript</title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
function redirecioneSemHistorico() { | |
// Faz um redirecionamento sem adicionar a página original ao histórico de navegação do browser. | |
window.location.replace("http://www.google.com.br"); | |
} | |
function redirecioneComHistorico() { | |
// Faz um redirecionamento mantendo a página original no histórico de navegaçãodo browser. | |
window.location.href = "http://www.youtube.com"; | |
} | |
</script> | |
<input type="button" value="Redirecionar sem Histórico" onclick="redirecioneSemHistorico();" /> | |
<br /> | |
<br /> | |
<input type="button" value="Redirecionar com Histórico" onclick="redirecioneComHistorico();" /> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Obrigado