mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-16 20:35:09 +00:00
Workaround apparent bug in Edge's history.pushState
When attempting to clear the hash state via history.pushState(), MS Edge in Windows 10 build 10159 errors out with the helpful "Unspecified Error". Catching the exception and trying again with a "#" works around the error and doesn't look any worse than the non-pushState code path -- and should have no side effects when the bug is fixed. Bug: T104381 Change-Id: I6ea4d367af64f85018b06b859ce688053a1caf0f
This commit is contained in:
parent
7b064306d8
commit
e77df57615
|
@ -469,7 +469,12 @@
|
|||
hash = window.location.href.replace( /#.*$/, '' );
|
||||
}
|
||||
|
||||
this.browserHistory.pushState( null, title, hash );
|
||||
try {
|
||||
window.history.pushState( null, title, hash );
|
||||
} catch ( ex ) {
|
||||
// Workaround for Edge bug -- https://phabricator.wikimedia.org/T104381
|
||||
window.history.pushState( null, title, hash + '#' );
|
||||
}
|
||||
} else {
|
||||
// Since we voluntarily changed the hash, we don't want MMVB.hash (which will trigger on hashchange event) to treat it
|
||||
this.skipNextHashHandling = true;
|
||||
|
|
Loading…
Reference in a new issue