1

Is there have any way to do this ? I am trying load some local file in the UIwebview, if the content include Image, loadHTMLString is taking much longer to finish page loading just because have to waiting the download of image file.

As I think if the image can be load in progressive mode, the UIwebview can display the html text on the very beginning to prevent the user keep too long time to waiting for the whole page loading.

P.S. The Image is from the internet,but the html string is on the local file

zap
  • 191
  • 3
  • 8

2 Answers2

-1

All you need to do is to have the images to be loaded in the Progressive JPEG format. To convert them using ImageMagick you can type:

convert somefile.xxx -interlace JPEG somefile_progressive.jpg

for example.

Another possible solution could be to load the images using JavaScript, once the page has been loaded fully.

Ie just leave the src blank in the html and set it via JavaScript later.

SideSwipe
  • 559
  • 3
  • 15
  • I don't think that using JPEG is an option, 'cause it would even take too long. – Fabio Poloni Mar 10 '12 at 11:22
  • @Mavrick3: Alternatively use one of these: [link](http://www.codinghorror.com/blog/2005/12/progressive-image-rendering.html). Or the JavaScript alternative. Or both. I dont know what images you want to display, JPEG for photos and GIF for buttons etc seems best though. – SideSwipe Mar 10 '12 at 13:08
-1

I would really use Javascript. You'd show a blank page or one with just a part of your content and after your document is ready (maybe use jQuery?) you load the other content.

document.getElementById('content1').innerHTML = "<img src="./images/something.png" alt="" />"
Fabio Poloni
  • 8,219
  • 5
  • 44
  • 74
  • I would use JS only to load images, more does make no sense. Why jQuery? He wants to make it more performant, so why add jQuery only to load images? Senseless. Dont change the innerHTML of a div or such, too. 'document.img01.src="somefile.xxx"' in your js and '' in your HTML. I guess that this should be faster than adding a new element to the DOM. – SideSwipe Mar 10 '12 at 13:19
  • @SideSwipe It was just an idea. – Fabio Poloni Mar 15 '12 at 16:41