jquery-archive / jquery-mobile

jQuery Mobile Framework
https://jquerymobile.com
Other
9.7k stars 2.41k forks source link

dialog not working for external links #1567

Closed phillpafford closed 13 years ago

phillpafford commented 13 years ago

Works if dialog.html is hosted locally

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

Does not work if calling with external link

a href="http://jquerymobile.com/demos/1.0a4.1/docs/pages/dialog.html" data-rel="dialog">Open dialog /a

Docs: http://jquerymobile.com/demos/1.0a4.1/docs/pages/docs-dialogs.html

toddparker commented 13 years ago

When I click on the dialog links on that test page, they open fine for me. Is there a specific platform or set of steps needed to reproduce?

phillpafford commented 13 years ago

Here is an example: http://jsfiddle.net/kzqTf/1/

The first option to open the dialog doesn't work, it just navigates to the page. The second option by clicking on the link to take you to the Dialog Documentation and then clicking the Open Dialog button, works as expected.

After some testing I noticed that if the page you wanted in the dialog wasn't on the same server, it would just navigate to the page instead of opening it up in a dialog

toddparker commented 13 years ago

Ah, well that makes sense because you can't Ajax in content from a different domain because of security reasons so jQM is defaulting to a non-ajax link in these cases. Since a dialog is just a normal page, it won't look like a dialog when viewed this way. If you're building a PhoneGap app, there is a setting that can be turned on to allow cross-domain requests but this isn't an option for web-based sites or apps.

phillpafford commented 13 years ago

Thanks! I didn't know if this action was expected or not.

Keep up the great work, excited for the first beta!!!