Open External Page in Popup in jQuery Mobile

橙三吉。 提交于 2019-12-12 10:43:30

问题


I'm using jQuery Mobile. Actually i want open an externl link in a popup. I tried this.

<a href="#" id="dialoglink"  data-rel="dialog">Open Dialog</a>
<script>
$(document).delegate('#dialoglink', 'click', function() {
    $(this).simpledialog({
        'mode' : 'blank',
        'prompt': false,
        'forceInput': false,
        'useModal':true,
        'fullHTML' : 
            'http://www.google.com/'
    })
});
</script>

It is opening a popup the content is the text http://www.google.com/. But i actually want to load the url. i.e google index page.


回答1:


You can do this with an ajax request:

$.get('http://url.to.load.net',function(data) {
    $(this).simpledialog({
        'mode' : 'blank',
        'prompt': false,
        'forceInput': false,
        'useModal':true,
        'fullHTML' : data
    });  
});

Nothing to recommend though, to do this with a whole page like google.com. simpledialog can't handle this type of content and it would destroy your markup structure. But you can load small pieces of HTML, like a list-view.



来源:https://stackoverflow.com/questions/10225453/open-external-page-in-popup-in-jquery-mobile

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