jQuery mobile: Meaningful URL for a dialog page?

走远了吗. 提交于 2019-12-13 02:23:19

问题


Is it possible to link to a dialog, and have it display as a dialog?

In other words:

  1. Open a dialog from an underlying page
  2. Bookmark the URL
  3. Open a new browser tab
  4. Paste the URL
  5. Have the dialog open up in front of its underlying page

I can't see how to link to the dialogs in the jQuery Mobile demo (or here) - if I copy the URLs, and reopen them, the underlying page opens but not the dialog.


回答1:


All you have to do is specify on your link that it should open the target as a dialog.

In the example on that documentation page you posted, the dialog-opening link is written as:

<a href="foo.html" data-rel="dialog">Open dialog</a>

If you are having problems, I'd suggest ensuring that your pages are setup properly (whether you are fetching them by Ajax or not).

EDIT

Let's say your base page is: www.example.com. The dialog page content is stored at www.example.com/dialog.html. If you wanted to send a dialoged link to someone, I would do it like this:

Add a hashtag to the end of the base url: www.example.com/#dialog=dialog%3Fhtml. The page would then look to see if it has any #dialog= at the end of its URL. If it does, programatically open the dialog. If you'd like some example code, feel free to ask.



来源:https://stackoverflow.com/questions/7296048/jquery-mobile-meaningful-url-for-a-dialog-page

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