Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

for HTML4 browsers, assume the URI passed to pushState() is URI-encod…

…ed, and make sure that every character is encoded like document.URL
  • Loading branch information...
commit 036ac100057982e5ba13b4a374608acc7ad1d044 1 parent 50c883e
Andrew Sayers authored

Showing 1 changed file with 11 additions and 1 deletion. Show diff stats Hide diff stats

  1. +11 1 scripts/uncompressed/history.html4.js
12 scripts/uncompressed/history.html4.js
@@ -454,7 +454,7 @@
454 454
455 455 // Push the new HTML5 State
456 456 //History.debug('History.onHashChange: success hashchange');
457   - History.pushState(currentState.data,currentState.title,currentState.url,false);
  457 + History.pushState(currentState.data,currentState.title,encodeURI(currentState.url),false);
458 458
459 459 // End onHashChange closure
460 460 return true;
@@ -473,6 +473,11 @@
473 473 History.pushState = function(data,title,url,queue){
474 474 //History.debug('History.pushState: called', arguments);
475 475
  476 + // We assume that the URL passed in is URI-encoded, but this makes
  477 + // sure that it's fully URI encoded; any '%'s that are encoded are
  478 + // converted back into '%'s
  479 + url = encodeURI(url).replace(/%25/g, "%");
  480 +
476 481 // Check the State
477 482 if ( History.getHashByUrl(url) ) {
478 483 throw new Error('History.js does not support states with fragment-identifiers (hashes/anchors).');
@@ -550,6 +555,11 @@
550 555 History.replaceState = function(data,title,url,queue){
551 556 //History.debug('History.replaceState: called', arguments);
552 557
  558 + // We assume that the URL passed in is URI-encoded, but this makes
  559 + // sure that it's fully URI encoded; any '%'s that are encoded are
  560 + // converted back into '%'s
  561 + url = encodeURI(url).replace(/%25/g, "%");
  562 +
553 563 // Check the State
554 564 if ( History.getHashByUrl(url) ) {
555 565 throw new Error('History.js does not support states with fragment-identifiers (hashes/anchors).');

0 comments on commit 036ac10

Please sign in to comment.
Something went wrong with that request. Please try again.