ios - UIwebview loading remote html with bundle/local images -


well, searched everywhere didn't have luck situation. loading webpage uiwebview following code:

nsstring *fullurl; fullurl=@"http://domain.com"; nsurl *url=[nsurl urlwithstring:fullurl]; nsurlrequest *requestobj=[nsurlrequest requestwithurl:url]; [_webview loadrequest:requestobj]; 

i want load remote html file load images bundle resourses. html file looks this:

<img src="http://domain.com/images/image.png" width="20px" height="20px"/> 

can done? majority of posts on internet(and here) loading local html local images/resources different in case.

any code? thanks

it better use more "loosely coupled" solution - not edit html code in hacky way (regexp, not regexp... changing html code manually still pretty hacky).

as matter of fact, believe can done. ios needs somehow informed of assets available offline, bundle.

basically, when uiwebview loading page, first thing happens behind scene downloading main *.html page. graphics/css'es/js'es etc being downloaded.

you can let html file downloaded "as is", intercept requests going download graphics (+ other assets) , provide them local bundle. please refer post:

http://robnapier.net/blog/offline-uiwebview-nsurlprotocol-588

and apply appropriate changes. big win here webview's (and code loads / maintain via javascript calls it's content) perspective - nothing has changed @ all. custom nsurlprotocol knows data loaded local storage.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -