Kyon147 Kyon147 - 1 year ago 71
jQuery Question

Load another page in page and append another url

I have looked everywhere for this but have no idea how to go about it.

I want to have links at the top of a page such as; News | Reviews | Images etc

When someone clicks on one those links, I want it to load content from another php file and at the same time append the link name on to the url. Example:

I have seen other sites do this like

I don't have any code examples because I am not sure how I would even start. I tried with .Load but not found that it works.

Answer Source

You can use the History API, you can use either pushState or replaceState to replace the url


The parameters for both functions are the same. The first one is an object that gets stored and passed to the onpopstate event. You can also retrieve it by history.state in the event of a browser restart.

The second is a title string, i believe at the moment no browsers fully utilize it so it can be whatever.

The last parameter is the new url you want in the address bar.

So if say you wanted to load your Images link and you wanted the url to look like /Images you would do something like


Session History Management Compatibility

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download