Start a new topic

load images from a HTMLDrawable html

load images from a HTMLDrawable html



I am working for iOS.


I am trying to load images from a HTMLDrawable using <img> tags. But I can´t load them from relative paths. I create the HTMLDrawable by giving a string value to the html property (not with property uri), because I later need to replace some character strings.


Html is:

"<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' ''><html><head><meta name='viewport' content='target-densitydpi=device-dpi, width = 512, user-scalable = 0' /><title>Poi details</title><style type='text/css'>* {margin: 0;}html, body {height: 100%;}body.custom {position:relative;margin: 0;opacity:0.8;filter:alpha(opacity=80);width: 512px;overflow:visible;}div.popup {position:absolute;width:80%;margin-left:10%;margin-top:10%;background-color: #000;border-radius:1em;}p.title {position:relative;margin:5%;font-weight:bold;font-size:2em;color:#FFF;}p.detail {position:relative;float:left;margin:5%;font-size:1.7em;color:#FFF;}img#distance {position:relative;float:left;width:10%;}</style></head><body class='custom'><div class='popup'><p class='title' id='poi-name'></p><img src='distance.png' id='distance' /><p class='detail' id='poi-distance'></p></div></body></html>?


The image I try to load is distance.png, I have it in the root folder of a "world" directory.


How can I load images directly from html?. Is it possible to load the absolute path and load the image from it?


Thanks you all!


Hi Nico,

I suggest to use absolute URIs to the referenced files. HTMLDrawables create a new "context" when they are created, so using absolute paths (remote locations will work) will avoid confusion.


Login or Signup to post a comment