|
1 | 1 | /*! |
2 | | - * History API JavaScript Library v4.0.9 |
| 2 | + * History API JavaScript Library v4.1.0 |
3 | 3 | * |
4 | 4 | * Support: IE8+, FF3+, Opera 9+, Safari, Chrome and other |
5 | 5 | * |
|
11 | 11 | * http://www.opensource.org/licenses/mit-license.php |
12 | 12 | * http://www.gnu.org/licenses/gpl.html |
13 | 13 | * |
14 | | - * Update: 2013-11-20 13:03 |
| 14 | + * Update: 2014-03-24 13:14 |
15 | 15 | */ |
16 | 16 | (function(window) { |
17 | 17 | // Prevent the code from running if there is no window.history object |
|
362 | 362 | // get hash fragment |
363 | 363 | href = href.replace(/^[^#]*/, '') || "#"; |
364 | 364 | // form the absolute link from the hash |
365 | | - href = windowLocation.protocol + '//' + windowLocation.host + settings['basepath'] |
| 365 | + // https://github.com/devote/HTML5-History-API/issues/50 |
| 366 | + href = windowLocation.protocol.replace(/:.*$|$/, ':') + '//' + windowLocation.host + settings['basepath'] |
366 | 367 | + href.replace(new RegExp("^#[\/]?(?:" + settings["type"] + ")?"), ""); |
367 | 368 | } |
368 | 369 | } |
|
728 | 729 | * @return void |
729 | 730 | */ |
730 | 731 | function onHashChange(event) { |
731 | | - // if not empty lastURL, otherwise skipped the current handler event |
732 | | - if (lastURL) { |
| 732 | + // https://github.com/devote/HTML5-History-API/issues/46 |
| 733 | + var fireNow = lastURL; |
| 734 | + // new value to lastURL |
| 735 | + lastURL = windowLocation.href; |
| 736 | + // if not empty fireNow, otherwise skipped the current handler event |
| 737 | + if (fireNow) { |
733 | 738 | // if checkUrlForPopState equal current url, this means that the event was raised popstate browser |
734 | 739 | if (checkUrlForPopState !== windowLocation.href) { |
735 | 740 | // otherwise, |
|
751 | 756 | dispatchEvent(event); |
752 | 757 | } |
753 | 758 | } |
754 | | - // new value to lastURL |
755 | | - lastURL = windowLocation.href; |
756 | 759 | } |
757 | 760 |
|
758 | 761 | /** |
|
0 commit comments