简体   繁体   中英

window.location.hash does not work after domain redirect

When the webpage is loaded I use window.location.hash to add imformation to the URL. Since I bought a domain name redirecting to my server IP it is not working anymore. Only the domainname.com is displayed. Although the hash operation is performed. What could be the reason?

You aren't using proper domain hosting.

Instead of pointing the domain at the IP address of your server (and configuring the web server to support Virtual Name Hosting if you are dealing in multiple sites there) you are letting your Domain Registrar point the domain at their server where they provide a simple web page consisting of a frame (this is known as "Domain Forwarding", "Domain Masking" or "Yuck").

When you set location.hash , you are setting the location of the frame, not the window.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM