I am using WebView to load locally referenced HTML files into my app. I have the folder structure:
-assets/
-www/
-css/
-images/
-js/
-index.html
index.html uses relative paths to link to the various css, javascript and image files eg:
<script src="js/functions.js" type="text/javascript"></script>
<link href="css/style.css" media="screen" rel="stylesheet" type="text/css" >
Because I am using relative paths I am loading the HTML content into the WebView by using this code in ViewController.h
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:@"assets/www"]];
[webView loadRequest:[NSURLRequest requestWithURL:url]];
When I run the iOS simulator the page successfully loads and displays an image from the images folder on the page. However the CSS and Javascript files do not load. Where am I going wrong?