如何防止在jQuery Mobile中堆叠链接对话框的URL [英] How to prevent stacking the URL of chained dialogs in jQuery Mobile

查看:99
本文介绍了如何防止在jQuery Mobile中堆叠链接对话框的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您在jQuery Mobile中链接对话框时,URL上堆积了这些& ui-state =对话框& ui-state =对话框..."字符串.有办法防止这种情况吗?

When you chain dialog boxes in jQuery Mobile there are these "&ui-state=dialog&ui-state=dialog..." strings stacked on the URL. Is there a way to prevent this?

Thnx!

推荐答案

  • 您可以尝试的是将rel=external添加到打开对话框的链接中.
    此属性将禁用Ajax导航,并应防止堆积URL.

    • What you can try is to add rel=external to the links which open the dialogs.
      This attribute will disable the Ajax navigation and should prevent stacking the URL.

      您还可以尝试pushState plugin:

      有一个可选功能,可以转换较长的,基于哈希的URL 上一节中提到的完整文档路径是 更清洁,并使Ajax跟踪在URL结构中透明. 这是作为基于散列的URL系统之上的增强功能而构建的 用于Ajax链接.请注意,尽管名称如此,但该功能在技术上 通过使用 history.replaceState 转换基于哈希的URL(不是 当前版本中的 history.pushState ),因为它更有效 可靠地跨我们的目标平台.对于不支持的浏览器 history.replaceState ,或者,如果禁用此功能,则基于哈希的URL 将会代替.

      There is an optional feature that converts the longer, hash-based URLs mentioned in the previous section into the full document path which is cleaner and makes the Ajax tracking transparent in the URL structure. This is built as an enhancement on top of the hash-based URL system for Ajax links. Note that despite the name, this feature technically converts hash-based URLs by using history.replaceState (not history.pushState) in the current release because this works more reliably across our target platforms. For browsers that do not support history.replaceState, or if this feature is disabled, hash-based URLs will be used instead.

      由于该插件会在DOM完全加载后初始化,因此您可以 通过设置 $.mobile.pushStateEnabled 手动启用和禁用它 在文档准备就绪之前,可以随时将全局配置选项设置为 false .

      Since the plugin initializes when the DOM is fully loaded you can enable and disable it manually by setting $.mobile.pushStateEnabled global configuration option to false anytime before document ready.

      您可以查看在线文档以获取更多信息:

      You can check the online doc for more information:

      http://jquerymobile.com/demos/1.2. 0/docs/pages/page-navmodel.html

      这篇关于如何防止在jQuery Mobile中堆叠链接对话框的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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