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" ...