Home  >  Article  >  Backend Development  >  Like segmentfault.com/faq#q8, the content after "#" is not only positioned at a location, but also performs certain operations. How is it achieved?

Like segmentfault.com/faq#q8, the content after "#" is not only positioned at a location, but also performs certain operations. How is it achieved?

WBOY
WBOYOriginal
2016-07-06 13:54:181072browse

For example, [http://loadpage.b0.upaiyun.com/#http://www.baidu.com] (the brackets are a complete address)
Accessing this page will redirect you Go to the URL after "#".
Can the content after "#" be obtained? Should I use js to get it on the front end or on the server side?

Reply content:

For example, [http://loadpage.b0.upaiyun.com/#http://www.baidu.com] (the brackets are a complete address)
Accessing this page will redirect you Go to the URL after "#".
Can the content after "#" be obtained? Should I use js to get it on the front end or on the server side?

Using location.hash in js is # and the content after it.

Like segmentfault.com/faq#q8, the content after

As follows, assuming your file name is index.html, when you visit index.html#windows.com, you will be redirected to windows.com