phonegap on android says: Not allowed to load local resource: file:///android_asset/www/app/fb.js

2,781 views
Skip to first unread message

algroup

unread,
Feb 4, 2012, 12:24:48 PM2/4/12
to phonegap
I load my main page using super.loadUrl("http://myURL/app.html"); and
in app.html I have lines like:

<script type="text/javascript" charset="utf-8" src="file:///
android_asset/www/app/fb.js"></script>


When I run it on device I get the following error in LogCat:

Not allowed to load local resource: file:///android_asset/www/app/fb.js


I would appreciate your help.

Bryce Curtis

unread,
Feb 6, 2012, 11:16:10 AM2/6/12
to phon...@googlegroups.com
When loading page from server, the webview security policy prevents loading local files.  This can't be overridden.  Try moving your fb.js to server.


--
You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en

For more info on PhoneGap or to download the code go to www.phonegap.com

suhas ghodke

unread,
Feb 6, 2012, 12:06:01 PM2/6/12
to phon...@googlegroups.com
try giving relative part
assuming your html file is in www folder.....

<script type="text/javascript" charset="utf-8" src="app/fb.js"></script>

this works for me :)

--Suhas--

suhas ghodke

unread,
Feb 6, 2012, 12:11:17 PM2/6/12
to phon...@googlegroups.com
oooops..... my apologies ... the above solution wont work..
i thought you have placed the html inside assets .... didnt saw http://myURL/app.html :)

i have seen lot of threads on JS injection, but never tried it on my own.
check if those work

--Suhas--

algroup

unread,
Feb 7, 2012, 12:57:58 PM2/7/12
to phonegap
Bryce,

Thanks for the reply but are you 100% sure about it?

DFallak

unread,
Feb 23, 2012, 3:40:54 PM2/23/12
to phonegap
Where do you get this information on the webview security policy from?
Could you provide a link? Can't find it in the WebView API reference
at http://developer.android.com/reference/android/webkit/WebView.html
...
Reply all
Reply to author
Forward
0 new messages