Change domain name in url bar with JavaScript

2019-09-10 07:31发布

问题:

Is there a way to use window.history.pushState or any other js function to change the whole url in the address bar? I haven't been able to remove the root part.

Context: my app is on Heroku and the url looks like http://mywebsite.herokuapp.com and I'd like to make it look like http://mywebsite.com . I can easily change what is after the .com but not what is before :(