Hope I understand your problem correctly:
1) upload a remote web page ... and
2) replace some remote resources with files in the / build application
Right?
Good thing I do as follows (I use it for videos because of the 5 MB cache limit on Mobile Safari, but I think that any other DOM content should work the same way):
• create a local (in order to compile using Xcode) HTML-page with style tags, so that the in-app / build subtitle is replaced with a hidden one, for example:
<div style="display: none;"> <div id="video"> <video width="614" controls webkit-playsinline> <source src="myvideo.mp4"> </video> </div> </div>
• the contents of the div are supplied in the same file, for example
<div id="content"></div>
• (using jQuery here) downloads the actual content from the remote server and add the local (imported Xcode object) to your target div, for example
<script src="jquery.js"></script> <script> $(document).ready(function(){ $("#content").load("http://www.yourserver.com/index-test.html", function(){ $("#video").appendTo($(this).find("#destination")); }); }); </script>
• drop www files (index.html / jquery.js / etc ... use the root levels for testing) into the project and connect to the target
• remote HTML file (here is located at yourserver.com/index-test.html) with
<base href="http://www.yourserver.com/">
as well as the destination separator, e.g.
<div id="destination"></div>
• and finally, in your Xcode project, load the local HTML code into the web view
self.myWebView = [[UIWebView alloc]init]; NSURL *baseURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]; NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]; NSString *content = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; [self.myWebView loadHTMLString:content baseURL:baseURL];
Works for me, best when combined with https://github.com/rnapier/RNCachingURLProtocol for offline caching. Hope this helps. F