Jquery移动: ui-state=dialog

标签 jquery jquery-mobile

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

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

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

最佳答案

为了解决刷新问题,我使用在页面创建时拦截 #&ui-state 和类似内容,并最终重定向到一个干净的 url:

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

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

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

关于Jquery移动: ui-state=dialog,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41142990/

相关文章:

jQuery:如何将超链接加载为 $.get 回调?

javascript - 为什么公共(public) Web 服务返回 200 OK 但没有 JSON

jquery Mobile - 导航其他页面后 JavaScript 停止工作

javascript - 移动浏览器中的 $(document).height() != $(window).height()

android - jQuery 手机 : how exit an application on button click in native android application

jquery - 带有 Squarespace 的图库幻灯片顶部的文本

javascript - 使用 var 将 xml 标签数据保存到 xml 文件中

jquery - 如何在 jQuery Mobile 中制作圆形按钮?

javascript - 在 JQuery Mobile 中填充下拉菜单后的下一步

javascript - 能够在单击时添加选项但无法将其删除(切换)