AntonAL
AntonAL

Reputation: 17410

replace path with jquery.address

I'm implementing global navigation on my web site, which I going to make deep linkable.

Navigation bar is presented in all pages. Each link in this navigation has following format

/categories/id

I' have a standard code, provided from oficial example.

When I'm on an index page and clicking navigation links, deeplinking works well – url is replaced from "http://example.com" to, say

http://example.com/categories/39

The problem occurs, when I first load page with url "http://example.com/categories/39".

When I clicking some of the links on navigation, url gets duplicated like this:

http://example.com/categories/39/categories/42

How can a fix this issue?

Thanks!

Update

I found, that this is possible with native JavaScript API:

window.history.pushState("object or string", "Title", "/zzz")

but, how to do it with jquery.address…?

Upvotes: 0

Views: 142

Answers (1)

AntonAL
AntonAL

Reputation: 17410

I found the solution.

I should provide "/" to $jquery.address.init() method:

$.address.state("/").init(...

instead of:

&.address.state(document.location.pathname).init(...

Upvotes: 0

Related Questions