0

My question is like this one, but my problem is not in IE (not tested), but in Chrome and Firefox. Anyway, that question has no responses.

I'm using BBQ plugin, with this code:

  $(window).bind('hashchange', function(e) {

            var href = $.param.fragment();

            hrefOld = $("#loadZone").attr("src");
            centerZoneActivePage = href;

            // Create container for this url's content and store a reference to it in
            // the cache.
            cache[ href ] = $("#loadZone").attr("src", href);
            alert("new: " +href);
   });

   // Since the event is only triggered when the hash changes, we need to trigger
   // the event now, to handle the hash the page may have loaded with.
   $(window).trigger( 'hashchange' );

What is happening, is that when I'm loading new pages in an iframe ("#loadZone"), the hash is changing correctly. But when I click in browser back button, the previous page is loading, but is not changing hash. When clicked by second time, hash changes and active page maintains in iframe. I don't understand why hash is not changing at first time, as previous page loading.

Note: the alert message only appears at second time in back button clicks.

Summary of back button clicks:

  • First click: Iframe previous page loaded, alert message not displayed, hash not changed;
  • Second click: Iframe page is still the same, alert message is displayed, hash is changed.

How to synchronize this? I'm using jquery-1.7.1.js. Anyone has used BBQ plugin with this version, with success? I have read this question, but its not conclusive.

1 Answer 1

0

Well, I solved the problem, deleting the iframe and creating a new one for each time a page load is required. Not pretty, but solved. Somehow, the iframe was in conflict with history control.

Not the answer you're looking for? Browse other questions tagged or ask your own question.