Q:

Run javascript from local resources using UIWebView

I have a simple question. I have two files. There are .html and .js files. I need to use .js file with my html content.
Right now I just have added method to load html from resources, but I have not found how to integrate .js to my UIWebView yet.
This is my code how I load html
[self.theWebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"test" ofType:@"html"]]]];

I know about stringByEvaluatingJavaScriptFromString method but as I think it will work with concrete function but in my case I have file with many function and I need to load all of them.

A:

either this is a very simple question, or I didn't understand you but you can add Javascript code to HTML using a simple <script> tag like this:
<script type="text/javascript" src="MY_JAVASCRIPT_FILE.js"></script>

Replace "MY_JAVASCRIPT_FILE.js" with the path of your Javascript file relative to the HTML file. (if they are in the same directory, no path is required, just write the file name).
If this is not the answer to your question please let me know. Thanks.

