Skip to content

Instantly share code, notes, and snippets.

@UlyssesAlves
Last active February 23, 2022 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save UlyssesAlves/103d41a40f30437d3bdab33cc2d13400 to your computer and use it in GitHub Desktop.
Save UlyssesAlves/103d41a40f30437d3bdab33cc2d13400 to your computer and use it in GitHub Desktop.
Como Redirecionar o Usuário Para Outra Página via JavaScript
<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>
@DjEdu10
Copy link

DjEdu10 commented Nov 6, 2019

Obrigado

@gibionmillak
Copy link

Obrigado, estava procurando isso.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment