<body class='gray'>
<section>
<i class='icon-loading i-large animate-spin'></i>
<h1>Redirecting to your new destination</h1>
<table class="most-width table-column-only center">
<thead>
<tr>
<th><h2>From</h2></th>
<th><h2>To</h2></th>
</tr>
</thead>
<tbody>
<tr>
<td id='old'></td>
<td id='new'></td>
</tr>
</tbody>
</table>
</section>
</body>
<script type="text/javascript">
var thishost = "google.com";
var thathost = "amazon.com";
var url = window.location.href.toString();
var current = document.getElementById('old');
var new = document.getElementById('new');
current.innerHTML = 'Current URL: ' + url;
var newurl = url.replace(thishost, thathost);
new.innerHTML = 'New URL: ' + newurl;
window.location = newurl;
</script>
This is a simple page I tried to throw together to just overwrite the first portion of the URL (i.e. the domain) and replace it with a different host.
It just doesn't want to work at all. It doesn't even change the innerHTML of the table cells. Am I doing something very obviously wrong?
new
is a reserved word... – haim770 Aug 2 '15 at 20:52