Remove fallback code for undefined history.pushState()
This commit is contained in:
parent
9273f7d4a7
commit
31ca37a1d0
1 changed files with 34 additions and 44 deletions
|
@ -101,7 +101,6 @@ OSM.Router = function (map, rts) {
|
||||||
|
|
||||||
var router = {};
|
var router = {};
|
||||||
|
|
||||||
if (window.history && window.history.pushState) {
|
|
||||||
$(window).on("popstate", function (e) {
|
$(window).on("popstate", function (e) {
|
||||||
if (!e.originalEvent.state) return; // Is it a real popstate event or just a hash change?
|
if (!e.originalEvent.state) return; // Is it a real popstate event or just a hash change?
|
||||||
var path = window.location.pathname + window.location.search,
|
var path = window.location.pathname + window.location.search,
|
||||||
|
@ -139,15 +138,6 @@ OSM.Router = function (map, rts) {
|
||||||
window.history.replaceState(state, document.title, window.location);
|
window.history.replaceState(state, document.title, window.location);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
router.route = router.replace = function (url) {
|
|
||||||
window.location.assign(url);
|
|
||||||
};
|
|
||||||
|
|
||||||
router.stateChange = function (state) {
|
|
||||||
if (state.center) window.location.replace(OSM.formatHash(state));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
router.updateHash = function () {
|
router.updateHash = function () {
|
||||||
var hash = OSM.formatHash(map);
|
var hash = OSM.formatHash(map);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue