Preload external images [PG 2.0/iOS]

308 views
Skip to first unread message

Bernhard Bezdek

unread,
Aug 3, 2012, 10:20:11 AM8/3/12
to phon...@googlegroups.com
Hey I'm not sure if this is a BUG.

I'm developing an app which preload each image before initial View is shown.
That works great (with images which are placed inside the img folder) and is an established step in my workflow my app.

Now I have an dynamic overview with Thumbnails placed in.
The thumbs are stored on an external server which is whitelisted in my .plist file and is shown if I embed the image directly via <img src="http://192.168.1.133/myimage.png"/>
But if I try to load these image via a JS preloader the complete will be never executed.

oImageList = new Image();
oImageList.onload = function() {
alert('finish')
}
I'm using:

- Phonegap 2.0
- iPad



Does anyone has a solution to solve this issue?


Thanks in advance


Bernhard

Shazron

unread,
Aug 3, 2012, 10:27:55 AM8/3/12
to phon...@googlegroups.com
Did you try hooking up the onerror and onabort events for Image? Maybe
that will give you a clue to what's wrong.
> --
> -- 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
>
> To compile in the cloud, check out build.phonegap.com
>
>

Bernhard Bezdek

unread,
Aug 3, 2012, 10:46:10 AM8/3/12
to <phonegap@googlegroups.com>
Yes you're right,

error callback is executed but why?
With the logadta of the error object I cannot find any useful message.

2012-08-03 16:41:08.353 myapp[3477:707] [INFO] returnValue->true
2012-08-03 16:41:08.355 myapp[3477:707] [INFO] timeStamp->1344004867322
2012-08-03 16:41:08.356 myapp[3477:707] [INFO] eventPhase->2
2012-08-03 16:41:08.358 myapp[3477:707] [INFO] target->[object HTMLImageElement]
2012-08-03 16:41:08.359 myapp[3477:707] [INFO] defaultPrevented->false
2012-08-03 16:41:08.360 myapp[3477:707] [INFO] srcElement->[object HTMLImageElement]
2012-08-03 16:41:08.362 myapp[3477:707] [INFO] type->error
2012-08-03 16:41:08.363 myappr[3477:707] [INFO] clipboardData->undefined
2012-08-03 16:41:08.364 myapp[3477:707] [INFO] cancelable->false
2012-08-03 16:41:08.366 myapp[3477:707] [INFO] currentTarget->[object HTMLImageElement]
2012-08-03 16:41:08.367 myapp[3477:707] [INFO] bubbles->false
2012-08-03 16:41:08.368 myapp[3477:707] [INFO] cancelBubble->false


Thanks 

Bernhard

Shazron

unread,
Aug 3, 2012, 11:12:40 AM8/3/12
to phon...@googlegroups.com
What does your whitelist entry look like. it should just be
"192.168.1.133" without any scheme or path.

On Fri, Aug 3, 2012 at 7:20 AM, Bernhard Bezdek <bernhar...@4fb.de> wrote:

Bernhard Bezdek

unread,
Aug 3, 2012, 11:28:55 AM8/3/12
to <phonegap@googlegroups.com>
Yes thats exactly the entry

Shazron

unread,
Aug 3, 2012, 1:07:03 PM8/3/12
to phon...@googlegroups.com
I just tested it with external images, it works fine. I think you have
to examine your plist entry - it is probably a sibling of
ExternalHosts instead of a child item.

Shazron

unread,
Aug 3, 2012, 1:18:26 PM8/3/12
to phon...@googlegroups.com
This is bad/confusing design on Xcode's plist editor more than
anything else -- unless you expand the disclosure triangle on a
selected item, clicking on "+" on an item will just make the new entry
a sibling item.

In any case, your console log should print out an error if it wasn't
in the whitelist regardless.
Reply all
Reply to author
Forward
0 new messages