Permalink
Browse files

Navigation: Check if window.history is available before replaceState

Fixes #8142
Closes #8438
  • Loading branch information...
apsdehal authored and arschmitz committed Jun 7, 2016
1 parent 4df25a6 commit 674bc8903711b44344b362ce405e40d8296d0907
Showing with 6 additions and 1 deletion.
  1. +6 −1 js/navigation/navigator.js
@@ -67,7 +67,12 @@ $.extend( $.mobile.Navigator.prototype, {
// Ensuring each history entry has a state object means that onPopState()
// will always trigger our hashchange callback even when a hashchange event
// is not fired.
window.history.replaceState( state, state.title || document.title, href );
//
// Check is to make sure that jqm doesn't throw type errors in environments where
// window.history is not available (e.g. Chrome packaged apps)
if ( window.history && window.history.replaceState ) {
window.history.replaceState( state, state.title || document.title, href );
}
// If we haven't yet received the initial popstate, we need to update the reference
// href so that we compare against the correct location

0 comments on commit 674bc89

Please sign in to comment.