Skip to content

Commit 9bd1d77

Browse files
committed
Core: update History after route changes in IE/Edge
1 parent 779d913 commit 9bd1d77

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/core/modules/router/back.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import $ from 'dom7';
22
import { document } from 'ssr-window';
33
import Utils from '../../utils/utils';
4+
import Device from '../../utils/device';
45
import History from '../../utils/history';
56
import redirect from './redirect';
67
import preRoute from './pre-route';
@@ -198,9 +199,11 @@ function backward(el, backwardOptions) {
198199
}
199200

200201
// History State
201-
if (router.params.pushState && options.pushState) {
202-
if (backIndex) History.go(-backIndex);
203-
else History.back();
202+
if (!(Device.ie || Device.edge)) {
203+
if (router.params.pushState && options.pushState) {
204+
if (backIndex) History.go(-backIndex);
205+
else History.back();
206+
}
204207
}
205208

206209
// Update History
@@ -221,6 +224,14 @@ function backward(el, backwardOptions) {
221224
// Current Route
222225
router.currentRoute = options.route;
223226

227+
// History State
228+
if (Device.ie || Device.edge) {
229+
if (router.params.pushState && options.pushState) {
230+
if (backIndex) History.go(-backIndex);
231+
else History.back();
232+
}
233+
}
234+
224235
// Insert Page
225236
insertPage();
226237

@@ -274,7 +285,7 @@ function backward(el, backwardOptions) {
274285

275286
// Preload previous page
276287
const preloadPreviousPage = app.theme === 'ios' ? (router.params.preloadPreviousPage || router.params.iosSwipeBack) : router.params.preloadPreviousPage;
277-
if (preloadPreviousPage) {
288+
if (preloadPreviousPage && router.history[router.history.length - 2]) {
278289
router.back(router.history[router.history.length - 2], { preload: true });
279290
}
280291
if (router.params.pushState) {

0 commit comments

Comments
 (0)