jQuery Mobile:ui-state = dialog [英] Jquery mobile: ui-state=dialog

查看:40
本文介绍了jQuery Mobile:ui-state = dialog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JQuery mobile作为用户菜单列表,但似乎保存了按下的按钮链接"ui-state = dialog",这在使用Web浏览器上的后退按钮时会干扰导航.如何删除添加到URL的"ui-state = dialog"?

Am using JQuery mobile for a usermenu list, but it seems to save the pressed button link "ui-state=dialog" Which is disturbing the navigation when am using the back button on the webbrowser. How can i remove the "ui-state=dialog" which adds to the URL?

示例: http://demos.jquerymobile.com/1.4.5/popup/

尝试第一个所谓的基本弹出窗口",保存的URL:"ui-state = dialog"仍然出现在浏览历史记录中.

Try the first so called "basic popup", the saved URL which is: "ui-state=dialog" still appears in the broswer history.

推荐答案

为解决刷新问题,我使用了## amp; ui-state以及类似的页面创建方法,并最终将其重定向到一个干净的URL:

To resolve the refresh problem, I use to intercept #&ui-state and similar on page creation and eventually redirect to a clean url:

$(document).on("pagebeforecreate",function(){
    if(window.location.hash!=""){
        window.location.replace(window.location.origin+window.location.pathname);
    }
});

为避免在浏览器历史记录中插入#& ui状态,可以在每个弹出窗口中添加data-history ="false":

To avoid to insert the #&ui-state in browser history, it's possible to add data-history="false" to every popup:

<div data-history="false" data-role="popup" ...

这篇关于jQuery Mobile:ui-state = dialog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆