问题
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