Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

TypeError window.history.replaceState within Chrome Packaged App #8142

Closed
davidhooey opened this issue Jun 1, 2015 · 4 comments
Closed

TypeError window.history.replaceState within Chrome Packaged App #8142

davidhooey opened this issue Jun 1, 2015 · 4 comments
Assignees
Milestone

Comments

@davidhooey
Copy link

Chrome Packaged Apps prevent the history API as mentioned here:

https://codereview.chromium.org/11196055

This causes an exception within jQuery Mobile like the following:

Error in response to storage.get: TypeError: window.history.replaceState is not a function
    at $.extend.squash (chrome-extension://lgdfkbpaenbbcabjamhbigiognieekhd/js/lib/jquery.mobile-1.4.4.js:2932:19)
    at $.extend.go (chrome-extension://lgdfkbpaenbbcabjamhbigiognieekhd/js/lib/jquery.mobile-1.4.4.js:3015:10)
    at Object.$.mobile.navigate (chrome-extension://lgdfkbpaenbbcabjamhbigiognieekhd/js/lib/jquery.mobile-1.4.4.js:3183:31)
    at $.widget.transition (chrome-extension://lgdfkbpaenbbcabjamhbigiognieekhd/js/lib/jquery.mobile-1.4.4.js:5644:15)
    at null.transition (chrome-extension://lgdfkbpaenbbcabjamhbigiognieekhd/js/lib/jquery.mobile-1.4.4.js:927:25)
    at null.<anonymous> (chrome-extension://lgdfkbpaenbbcabjamhbigiognieekhd/js/lib/jquery.mobile-1.4.4.js:5357:10)
    at Object.x.isFunction.i (chrome-extension://lgdfkbpaenbbcabjamhbigiognieekhd/js/lib/jquery-1.10.2.min.js:4:6426)
    at c (chrome-extension://lgdfkbpaenbbcabjamhbigiognieekhd/js/lib/jquery-1.10.2.min.js:4:26036)
    at Object.p.add [as done] (chrome-extension://lgdfkbpaenbbcabjamhbigiognieekhd/js/lib/jquery-1.10.2.min.js:4:26346)
    at $.widget._loadUrl (chrome-extension://lgdfkbpaenbbcabjamhbigiognieekhd/js/lib/jquery.mobile-1.4.4.js:5350:22)

Changing line jquery.mobile-1.4.4.js:2932 to first check for the presence of the function seems to solve the problem.

if(window.history.replaceState) {
    window.history.replaceState( state, state.title || document.title, href );
}

Even with the workaround a Chrome Packaged Apps continues to console.log the fact that history.replaceState is not available.

history.replaceState is not available in packaged apps.

Setting options mentioned in #5465 does not help. Seems as though a different way is needed to disable history.

Google Chrome: Version 43.0.2357.81 (64-bit) (Mac 10.10 & Windows 2008)
jQuery Mobile: 1.4.4

@samucs
Copy link

samucs commented Jun 19, 2015

Hi, I have the same problem. Can't make it work with jQuery Mobile 1.4.5. Has anyone solved this issue?

@arschmitz
Copy link
Contributor

Thank you for reporting this we will look into making sure this is fixed for the upcoming 1.5 release

@laminko
Copy link

laminko commented Sep 14, 2015

same problem, too. chromium 44.0.2403.89 (64 bit). jquerymobile 1.4.3.
thanks.

@dt1973
Copy link

dt1973 commented Sep 20, 2015

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants