11

This is my second project using jQuery Address, and I think there is something weird with Firefox, or at least I can figure out that it has a different behavior in Firefox and Webkit.

When deep linking, jQuery Address should fire a change event and execute the piece of JavaScript related to this state.

For /foo/bar deep link, if I write down the event object to the console, in Google Chrome, I have two events fired :

jQuery.Event #1

path: "/"
pathNames: Array[0]
queryString: ""
timeStamp: 1335431580471
type: "change"
value: "/"

jQuery.Event #2

path: "/foo/bar"
pathNames: Array[2]
queryString: ""
timeStamp: 1335431580471
type: "change"
value: "/foo/bar"

But in Firefox, I have only one event fired, that doesn't take in account the current URI :

jQuery.Event #1

path: "/"
pathNames: Array[0]
queryString: ""
timeStamp: 1335431580471
type: "change"
value: "/"

So obviously in Firefox the lightbox that I want to open for the /foo/bar URI is never going to open :-(

Here is my code for jQuery address :

$.address.crawlable(1).state('/').change(function(event) {
    var page = event.path;
    if (page == '/foo/bar'){
        openLightbox($('#create-popup-template').html());
        create_main();
    }
});    

For now I am using a simple workaround to make it work in Firefox, just adding a init function to force a second change event in Firefox :

$.address.init(function(){
    if ($.browser.mozilla)
         $.address.value(window.location.pathname);
 });

But it's been the second time I have to do this and it doesn't feel right.. am I missing something ?

I also already tried to mess up with internal and external changes callbacks, with no chance..

Thanks for helping,

Thomas.

ITConflux
  • 75
  • 13
skiplecariboo
  • 782
  • 1
  • 8
  • 21

1 Answers1

0

I use Asual jQuery Adress plugin 1.6 that you can find here : enter link description here and not on Asual website.

In this version, they have remove crawable feature (but it can be crawled by Google normaly). Additionnaly, you can compress it with http://refresh-sf.com/yui/

So it's maybe a bug of 1.5 versions

Hugo Gresse
  • 14,772
  • 8
  • 69
  • 103