Created
May 19, 2020 18:08
-
-
Save vhmolinar/f9b64044fd912935ece5fc39c9602b3f to your computer and use it in GitHub Desktop.
Html redirect example
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
<head> | |
<link rel="canonical" href="https://yourlink.com"/> | |
<noscript> | |
<meta http-equiv="refresh" content="0;URL=https://yourlink.com"> | |
</noscript> | |
<!--[if lt IE 9]><script type="text/javascript">var IE_fix=true;</script><![endif]--> | |
<script type="text/javascript"> | |
var url = "https://yourlink.com"; | |
if(typeof IE_fix != "undefined") // IE8 and lower fix to pass the http referer | |
{ | |
document.write("redirecting..."); // Don't remove this line or appendChild() will fail because it is called before document.onload to make the redirect as fast as possible. Nobody will see this text, it is only a tech fix. | |
var referLink = document.createElement("a"); | |
referLink.href = url; | |
document.body.appendChild(referLink); | |
referLink.click(); | |
} | |
else { window.location.replace(url); } // All other browsers | |
</script> | |
<!-- Credit goes to http://insider.zone/ --> | |
<!-- REDIRECTING ENDS --> | |
</head> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Replace https://yourlink.com by your own address.