Created
September 26, 2014 13:10
-
-
Save motyar/b77fae350ee62dd07831 to your computer and use it in GitHub Desktop.
Redirect to new domain with only JavaScript
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<script> | |
(function(){ | |
var url = window.location.href; | |
console.log(url.split('/')); | |
var newUrl = url.replace(url.split('/')[2],"newdomain.com"); | |
console.log(newUrl); | |
if(newUrl!=""){//Redirect to github edit | |
//alert(editUrl); | |
window.location.href = newUrl; | |
} | |
})(); | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment