问题原文
原帖链接 · Lorenzo Lapucci · CC BY-SA 3.0
You can change a URL like google.com to google.com/test without reloading the page by JavaScript.
Is it possible to completely change the URL like from google.com to Welcom.To.The.Website using the URL bar as a display?
已采纳解答
原帖链接 · MrWhite · CC BY-SA 3.0
Is it possible to completely change the url like from google.com to Welcom.To.The.Website
No, you cannot change the domain (ie. the origin). Presumably you are referring to HTML5's pushState()? From Mozilla Developer help:
The new URL must be of the same origin as the current URL; otherwise, pushState() will throw an exception.
Apart from being confusing for users. This would also be a security issue. Pretending to be a site you are not - phishing. A website could also trick you into visiting another malicious website just by hitting the back button.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
