How to prevent stacking the URL of chained dialogs in jQuery Mobile

若如初见. 提交于 2019-12-11 06:38:34

问题


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!


回答1:


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

  • You could also try the pushState plugin:

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.

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



来源:https://stackoverflow.com/questions/12843852/how-to-prevent-stacking-the-url-of-chained-dialogs-in-jquery-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!