Created
January 25, 2017 21:06
-
-
Save sadasant/8ec220c07764c36180f885cb11f934c7 to your computer and use it in GitHub Desktop.
Revisions
-
sadasant revised this gist
Jan 25, 2017 . 1 changed file with 16 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,13 +3,27 @@ * @method checkUrl * @return {boolean} Returns true/false from loading the url. */ function cleanFragment(s) { return s .replace(/%7E/g, "~") .replace(/%21/g, "!") .replace(/%2A/g, "*") .replace(/%28/g, "(") .replace(/%29/g, ")") .replace(/%27/g, "'") .replace(/%2D/g, "-") .replace(/%2E/g, ".") .replace(/%5F/g, "_") } history.checkUrl = function() { var current = history.getFragment(); var compareCurrent = cleanFragment(current); var historyFragment = cleanFragment(history.fragment); if (compareCurrent === historyFragment && history.iframe) { current = history.getFragment(history.getHash(history.iframe)); } if (compareCurrent === historyFragment) { return false; } -
sadasant created this gist
Jan 25, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ /** * Checks the current URL to see if it has changed, and if it has, calls `loadUrl`, normalizing across the hidden iframe. * @method checkUrl * @return {boolean} Returns true/false from loading the url. */ history.checkUrl = function() { var current = history.getFragment(); if (current === history.fragment && history.iframe) { current = history.getFragment(history.getHash(history.iframe)); } if (current === history.fragment) { return false; } if (history.iframe) { history.navigate(current, false); } history.loadUrl(); };