I have a few images that are part of a web page which i want to load into a webview. The images are saved locally.
I load the html like this, and everything works well:
NSURL *baseUrl = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
[self.webView loadHTMLString:myHtmlStringWithImgTags baseURL:baseUrl];
The html is displayed correctly.
When my IMG-tags look like this, everything works well:
<img src="image.png" />
However, I will get these images from html generated by EpiServer, and the img tags will look like this:
<img src="/image.png" />
I do not want to start parsing the html and remove the absolute path to root at the beginning of the src-tag. How to solve this? What should I have as baseUrl?
Thanks.
EDIT:
Seems to be a common problem: Remap UIWebView root URL to [[NSBundle mainBundle] bundleURL]
Anyone got a solution except starting to hack the html and remove the root-paths?