Is it possible to replace the origin of the URL without reloading the page? Say I am at www.example.com
, how can I change the URL to be www.foo.com
or whatever without reloading the page? I tried using pushState()
and replaceState()
to no avail. I get an error saying: Failed to execute 'pushState' on 'History': A history state object with URL 'foo.com:4041' cannot be created in a document with origin 'http://example.com:4041' and URL 'http://foo.com:4041/'
.
For your information. the two URLS are ones which I generated with my /etc/hosts
file, they simply pass to an express server at localhost:4041
.
Thanks