Closed. This question is
not reproducible or was caused by typos. It is not currently accepting answers.
Answer
Solution:
If you have a domain1 that want to disappear from the internet and you want to show end users the domain2 instead, then you need to own both domains and make sure both domains are pointing to the same site then from domain1 do a 301 redirect into domain2
Answer
Solution:
If you want to manipulate window object internally (inside your code only), than don't use window.location
, but create own info using URL Api:
var $url = new URL('http://google.com/something');
function onClick() {
document.getElementById("demo1").innerHTML = $url.href;
}
<div id="demo1"></div>
<button onClick="onClick()">Get data</button>
Source