jQuery GetScript fails with 404 on Phonegap app on Android 4.0

1,662 views
Skip to first unread message

Davide Senatore

unread,
Mar 14, 2012, 6:41:49 AM3/14/12
to phonegap
Hello, i have a phonegap app, compiled for android. I use jQuery,
jQuery mobile and custom scripts, but the application doesn't work on
Android 4.0.
In mobileinit event i perform a call to jquery getScript to load on
demand a custom script containing some variables. The call returns 404
ONLY on Android 4.0.
On Froyo and Gingerbread everything works perfectly, and the same app,
viewed as a Mobile Site works on every platform, even on Android 4.0.
So, it seems a problem related with assets and PhoneGap and Android
4.0.
Anyone has noticed the same problem?
Thanks!

Davide - gymmit.com

Chaaarly

unread,
Mar 22, 2012, 6:08:40 AM3/22/12
to phon...@googlegroups.com
I have exactly the same problem for my Android/iOS app, no problem with getScript on iOS or previous Android versions. Only a 404 error on Android 4 ICS.

No solution found yet :/

Chaaarly

unread,
Mar 22, 2012, 9:09:31 AM3/22/12
to phon...@googlegroups.com
For information, i tried to update Phonegap to the last version 1.5.0 (Cordova) but nothing changed.

I also tried to put the file on the internet and get it throw a full HTTP URL :


...and it worked.

So i tried with an absolute local URL :

$.getScript("file:///android_asset/www/resources/myscript.js");

...but i had a 404 too. 
 
Hope it will help...

Le mercredi 14 mars 2012 11:41:49 UTC+1, Davide Senatore a écrit :

Davide Senatore

unread,
Mar 23, 2012, 9:23:52 AM3/23/12
to phonegap
Thanks, i had already done the test, calling a "local" full URL throws
an error 404. I can confirm it.
The problem seems to depend on ICS, due to the fact that the SAME
application works perfectly on Android Gingerbread and Froyo.
This is very bad... and make me feel like i'm creating unstable
applications.

Esteban Cuevas

unread,
Mar 26, 2012, 6:17:13 PM3/26/12
to phon...@googlegroups.com
Same problem here.
Really frustrated about it.

Anyone found any workaround to this?
(Thanks)

Kakone

unread,
May 15, 2012, 9:39:30 AM5/15/12
to phonegap
I have the same problem for local files on Android 4 but also on
Windows Phone. I didn't find any solution.

How have you solved the problem ?

Cordially,
Kakone.

Chaaarly

unread,
May 15, 2012, 10:53:54 AM5/15/12
to phon...@googlegroups.com
No, i didn't find any solution.

kaore

unread,
Jun 8, 2012, 4:11:07 AM6/8/12
to phon...@googlegroups.com
Just bumped into the same problem. Yeepeekayay.

kaore

unread,
Jun 8, 2012, 5:13:26 AM6/8/12
to phon...@googlegroups.com
In the end I ended up not using getScript but just a regular javascript function to fetch the js in external files. It worked for me in Android 4.

Try the loadJs function in the answer on this page: http://stackoverflow.com/questions/8631400/load-external-javascript-file
Reply all
Reply to author
Forward
0 new messages