Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
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

Description

@davidhooey

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions