[PhoneGap] loading a local html file into an iframe using javascript on Android

1,561 views
Skip to first unread message

Jeremy A

unread,
Jul 10, 2011, 8:11:56 PM7/10/11
to phon...@googlegroups.com


All

I have an iframe with the name and id  'about'

eg. <iframe id='about' name='about' scrolling='no' src='splash.html' >

I have a button that is supposed to load another *local* html file, (by replacing the src) into the iframe.

this works fine in a regular chrome browser, but when I try it on the device, it loads as the main page.

how do i target it into the iframe using javascript.

I believe the code in question is:

document.getElementById('about').src= "file.html";

your help is appreciated. many thanks in advance.

-Jeremy



AbhishekKanitkar

unread,
Jul 11, 2011, 2:44:30 AM7/11/11
to phonegap
Give the iframe src="file:///android_asset/www/splash.html".
You should get the html content displayed in iFrame with this.

Smit Shah

unread,
Feb 28, 2014, 10:07:01 AM2/28/14
to phon...@googlegroups.com
I tried using the logic you recommended, but it did not work
I am trying to reference the .JS files on my machine
As well as redirect the entire page to the local file, neither are working

<a href="file:///android_asset/www/contact.html">Local Phone</a>

would not work
<script src="file:///android_asset/www/phonegap.js"></script>
Reply all
Reply to author
Forward
0 new messages