Displaying image from external url using phonegap / jquery for android

I am trying to display an image from an external url like below using phonegap / jquery for an android app but getting an app error because "connection to server failed"

img src = "http://www.techinasia.com/techinasia/wp-content/uploads/2009/12/Search.jpg"

Please help us with this.

+3
jquery android jquery-mobile cordova


source to share


6 answers


When creating whitelisted links, make sure that there is no slash "/" at the end of the URL.

<access origin="http://google.com" /> <!--  this works -->
<access origin="http://google.com/" /> <!-- this doesn't -->

      



In my case, I was getting question marks because of this, hope this might be helpful for someone in the future

+5


source to share


You need to whitelist the external website. See how here: http://docs.phonegap.com/en/1.9.0/guide_whitelist_index.md.html



+4


source to share


try it

<a href="#"><img src="http://www.techinasia.com/techinasia/wp-content/uploads/2009/12/Search.jpg"  data-rel="external"/></a>

      

0


source to share


In the onCreate method of the class that DroidGap extends, you will want to increase the HTML file load timeout to get the remote image. Add ...

super.setIntegerProperty("loadUrlTimeoutValue", 60000);

      

to the onCreate method.

0


source to share


Another possible problem is that you did not put the URL (domain) of the image source in the phonegap.plist file.

0


source to share


Just resize the image with any image compressor and only use .jpg

images.

0


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics