vcuongvu
vcuongvu

Reputation: 761

HTML5 - History API

When looking for a way to change a page without refreshing all the content I found out the history API.

Apparently, it is possible to make a link that change a part of the page and have an impact on the history. For example, this link could send me from myaddress.com to myaddress.com/page.html from this link and only update the subpage.

But how could I get the url myadress.com/page.html go directly to the right page with all the content outside the subpage ?

The following demo (not mine) does the content replacement but not the url routing for example : https://html5demos.com/history/

I would like to avoid URL rewriting and jquery if possible.

Upvotes: 1

Views: 69

Answers (1)

Quentin
Quentin

Reputation: 944432

The same way you would do it if you were using a regular link and no JavaScript in the first place.

Generally that would involve a server side language with a template (so you can avoid duplicating content (like menus) that is shared between pages.

You could just create static HTML files though.

Upvotes: 1

Related Questions