jqueryjquery-pluginsjquery-address

Why does the jQuery Asual Address plugin fire the change event twice?


Greetings,

I'm using the jQuery Asual Address plugin: http://www.asual.com/jquery/address/

For some reason, in Firefox and IE (but not Chrome), the address change event is firing twice when one of the parameters is a url (starts with "http://").

Here's a fiddle with an example: http://jsfiddle.net/5L6Ur/

Clicking on the "foo" link demonstrates my problem. Any help is greatly appreciated.

Code:

$(function() {
    $('a').click(function(e) {
        e.preventDefault();
        $.address.value($(this).attr('href'));
    });
    var changecount = 0;
    $.address.change(function(event) {
        $('span').html(changecount++);
    });
});

<a href="?u=http://foo.bar">foo</a><br />
<a href="?u=foo.bar">bar</a><br />
<span></span>

Solution

  • Looks like the latest version of the plugin on github (1.4) fixes this.

    Here's an updated example using the latest plugin: http://jsfiddle.net/5L6Ur/10/