Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I embed iframe in PhoneGap app?

There is a responsive scheduling website that renders a mobile view when on a phone. I want show this webpage within my PhoneGap div that way i can keep my header and navigation. Regular iframe code seems not to work for me. Can someone give me a hint on how to get this working like in the screenshot below.

Here is what i currently have:

    <div id="set" title="Set Appointment" class="panel">
            <iframe width="320px" height="480px" src="http://google.com"></iframe>
    </div>  

enter image description here

like image 887
KlassAktKreations Avatar asked Jul 03 '13 22:07

KlassAktKreations


People also ask

How do I embed an iframe?

To embed an iframe in a content page, select Interactive layout, choose the HTML block and paste the iframe code there. You can adjust the iframe width and height properties. To embed an iframe using the Old (Classic) editor, click on the Embed Media icon and paste the code in the appropriate field.

Where can I embed an iframe?

The iframe element is specified with the iframe tag. It may be placed anywhere in an HTML document, and thus anywhere on a web page. Iframes are most often used to embed specific content from one web page — like a video, form, document, or even a full web page — within a different web page.

Can you put an iframe in a div?

Approach 1: For adding additional div's in an iframe, you need to use a wrapper div, that wraps the contents of your intended div and the iframe into one unit. This way you can display the contents of your div along with the iframe embedding to the document/webpage.

How do I create an iframe?

To generate iframe, you need to set a URL to embed, width and height, scroll, disable or enable border, specify border type, size and border color, and add the iframe Name. Then, click the “Create iframe“ button to generate HTML code and push the “Copy To Clipboard“ button for copying the result.


2 Answers

This works:

<iframe src="http://www.myschedulingwebsite.com/" style="width:100%; height:100%;">

Setting the height and width to 100% fills the containing div.

NOTE: If you attempt to embed an iframe using a website that can only be displayed in a frame on the same origin as the page itself, the web inspector will throw the error below:

Refused to display 'https://www.google.com/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

With that said, www.google.com and several other site's embedded iframes will always be blank. I hope this helps someone.

like image 127
KlassAktKreations Avatar answered Oct 30 '22 21:10

KlassAktKreations


<iframe src="mypage.html" style="position:fixed; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;">
    Your browser doesn't support iframes
</iframe>
like image 40
Mahdi Esmaeili Avatar answered Oct 30 '22 23:10

Mahdi Esmaeili