网页后退问题。

现在有index,order,comment3个页面。order点击评论到comment,comment新增评论重定向到order。现在想要comment重定向到order之后,order后退的时候不能又退回到comment页面,直接退回到index页面。

jQuery(document).ready(function ($) {
 if (window.history && window.history.pushState) {
 window.onpopstate = function () {
 location.href = "index.aspx";
 };
 window.history.pushState('forward', null, "order.aspx");
 }
});

在order使用history做的限制,当在其他页面点击后退,好像会触发order页面的后退事件,直接从其他页面退回到index了(ps:PC上没有问题,手机会有该问题出现(微商城))。正确的应该是其他页面-order-index。求指教。


达令说
浏览 591回答 2
2回答

九州编程

传回来一个标识作为判断。

慕姐8265434

在commet新增评论跳往order 之前 用replaceState({},'index.aspx')
打开App,查看更多内容
随时随地看视频慕课网APP