0

I'm trying to develop an application using UIWebView. The app is loading remote URL's, so in order to make it quick I want it to use the images included in the application bundle. I was wondering if there is a way to do it without forcing the application to manually replace the address of each image to point into local resources?

AragornSG
  • 1
  • 1

2 Answers2

1

I doubt it, unfortunately. Browser security models in general (and this applies to browsers on the desktop as well of course) don't allow file:// scheme URLs to be used in the context of any other scheme (http://) page. If this was allowed, then arbitrary sites you browse to could load local files and possible access private user data, which would be Bad. Local images with the file:// scheme will only work in a page that is itself in the file:// domain.

I'm not sure how to tell you to accomplish this, but perhaps someone else has a clever idea.

Ben Zotto
  • 70,108
  • 23
  • 141
  • 204
0

You can use this:

Stop Images from loading in UIWebView

...which sounds horrendous, but is actually quite easy to do, and lets you replace requests for the remote URL with a hit to the local URL.

You'll have to convert the URLs manually, of course.

Community
  • 1
  • 1
Adam
  • 32,900
  • 16
  • 126
  • 153