简体   繁体   中英

Push State - How to update relative links

I want to use push state to update the url when loading ajax content. The urls changed via push state lead to some directories deeper.

I also have other normal relative links in the website and unfortunately they don't update. So if I click an url after loading the content and changing it via push state, the link tries to load the file one directory deeper...

I need to use relative urls, so do you have other ideas?

Edit:

for example i have this url:

http://www.example.com/site/profile

i change it to this one via push state for example:

http://www.example.com/site/profile/information

And i have a link that leads relative to another file, for example:

<a href="../anotherSite">

The Problem is that the relative links are not updated, so after the url was changed, the link leads to: http://www.example.com/site/anotherSite and not http://www.example.com/anotherSite like it should...

Okay, finally after some hours of search I found a solution and after asking that question, too.

I set a base url, so I dont have to update the urls.

(base html tag)

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