简体   繁体   English

在jQuery Mobile中处理历史记录

[英]Manipulate History in jQuery Mobile

I've stumped into a problem with my mobile app. 我的移动应用程序遇到了问题。 After submitting a non-Ajax form and reloading the page, my back button simply reloads the same page since there are, I assume, two entries for the item page. 提交非Ajax表单并重新加载页面后,我的后退按钮只是重新加载相同的页面,因为我认为,项目页面有两个条目。

The flow: 流程:

View List Page 查看列表页面

View Item Page 查看项目页面

Click Edit 单击编辑

Submit Form on Edit Dialog (submits / non-AJAX) 在编辑对话框上提交表单(提交/非AJAX)

View Item Page 查看项目页面

Click Back 单击返回

View Item Page 查看项目页面

Is there any way to exclude the 2nd View Item Page from the history stack? 有没有办法从历史堆栈中排除第二个查看项目页面?

I also faced same problem in my application. 我的申请也遇到了同样的问题。 Following code will give solution for your problem. 以下代码将为您的问题提供解决方案。

      window.history.go(-attempt);

attempt mean how many time you change (click) the page. 尝试意味着您更改(单击)页面的时间。 I used pagebeforechange event to count the number of attempts. 我使用pagebeforechange事件来计算尝试次数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM