Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open External Page in Popup in jQuery Mobile

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.

like image 897
Arasu Avatar asked Apr 19 '12 09:04

Arasu


People also ask

How do I open an external html page as a popup in jQuery?

html into a placeholder (i.e <div id="PopupPH"> ). This placeholder can be placed either inside data-role="page or outside it, depending on jQuery Mobile version you are using. Moreover, in popup. html, you need to change data-role=page" to data-role="popup in order to treat it as a popup not a page.

How do I show iframe in popup?

You can do this by binding to the popupafterclose event. This is the complete script and the link to open the video popup: $( document ). on( "pageinit", function() { $( "#popupVideo iframe" ) .

How do I show a popup in jQuery?

Approach: A simple pop can be made by using toggle() method of jQuery which toggles between hide() and show() function of jQuery i.e. it checks the visibility of the selector used. The hide() method is run when the selector is visible and show() is run when the selector is not visible.


1 Answers

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.

like image 84
daniel.auener Avatar answered Oct 03 '22 14:10

daniel.auener