Skip to content

Commit

Permalink
added ahoward's fix to jquery.postmessage to keep hash clean for olde…
Browse files Browse the repository at this point in the history
  • Loading branch information
thomassturm committed May 24, 2011
1 parent b54435c commit f7bb2f1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ender-postmessage.js
Expand Up @@ -24,6 +24,7 @@
// A few vars used in non-awesome browsers
var interval_id,
last_hash,
original_hash,
cache_bust = 1,

// A var used in awesome browsers.
Expand Down Expand Up @@ -178,11 +179,18 @@
? delay
: 100;

original_hash = document.location.hash;

interval_id = setInterval(function(){
var hash = document.location.hash,
re = /^#?\d+&/;
if ( hash !== last_hash && re.test( hash ) ) {
if ( hash !== last_hash && hash !== original_hash && re.test( hash ) ) {
last_hash = hash;
if ( original_hash ) {
document.location.hash = original_hash;
} else {
document.location.hash = '';
}
callback({ data: hash.replace( re, '' ) });
}
}, delay );
Expand Down

0 comments on commit f7bb2f1

Please sign in to comment.