Sunday 15 July 2012

ios6 - Cannot get local javascript file to execute when web view loads a remote page -


I've worked on it for several days and I do not know what I'm doing.

  • I have moved the javascript file into the copy bundle.
  • See the code below.

      - (zero) webViewDidFinishLoad: (UIWebView *) webView {NSString * jspath = [[NSBundle main bundle] pathForResource: @ "doc" ofType: @ "JS" in directory: no] ; NSString * js = [NSString stringWithContentsOfFile: jsPath encoding: NSUTF8StringEncoding error: zero]; [Webview stringbivy evelating javascript framestrings: jsa]; }     

    My JavaScript file looks like this

      & lt; Script type = "text / javascript" & gt; Warning ("Hello"); & Lt; / Script & gt; Delete script tags from JavaScript and it will work     



  • No comments:

    Post a Comment