user1546328
user1546328

Reputation:

Implement links on single-page web design

Simply put: I have a single-page website, for instance www.example.com. How do I make a link pointing to www.example.com/sub not trigger an unload, but still change the address bar as if it did?

example1

example2

Upvotes: 0

Views: 57

Answers (1)

Amadan
Amadan

Reputation: 198388

HTML History API can do this.

history.pushState({data: "foo"}, "SubPage", "http://www.example.com/sub")

You can kind-of use History JS to shim it in for the older browsers (it will fake it with hash links in non-compliant browsers).

Upvotes: 1

Related Questions