jQuery mobile: Meaningful URL for a dialog page?
Is it possible to link to a dialog, and hav开发者_如何学Goe it display as a dialog?
In other words:
- Open a dialog from an underlying page
- Bookmark the URL
- Open a new browser tab
- Paste the URL
- 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.
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.
精彩评论