Using slash in window.location.hash

If I changed the hash as follows: window.location.hash = "main/0/sub/1/na/false";. The address in the browser will change to http://mysite.com/#main/0/sub/1/na/false. The onhashchange page fires and everything works as intended.

However, in Firebug, I see that I am also sending a request: http://mysite.com/main/0/sub/1/na/false... URL without hash, which results in 404 silence in the console.

When I debug, I find that this happens at a point window.location.hash.

But if I change the hash like this: window.location.hash = "main=0&sub=1&na=false";no extra request is sent.

Why is an additional request sent in the first example?

UPDATE: I noticed that it sends a request after window.location.hashand before (during?) $(window).bind('hashchange'). Example if I have ...

window.location.hash = 'main/0/sub/1/na/false'; // Breakpoint 1 in Firebug

$(window).bind('hashchange', function(e) {
    e.preventDefault();   // Breakpoint 2 in Firebug
    e.stopPropagation();
});

1, . 2, .

Apache Tomcat, .

, jQuery jQuery Mobile.

2: jQuery Mobile . :/

3

- : jQuery Mobile: http://jsfiddle.net/pioSko/hz5PU/3/

jQuery Mobile: http://jsfiddle.net/pioSko/hz5PU/4/

Firebug .

+5
2

History.js. , script, , URL- (-), .

+3

. , URL-, firefox, , , , , URL-.

-4

All Articles