w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to call the html function while loading the html file in webview?

When you call loadRequest: on UIWebView it will start loading the URL. This is asynchronous process. Until this completes, UIWebView will not have effect by calling stringByEvaluatingJavaScriptFromString: method.

Implement this UIWebViewDelegate method and call the required JS function.

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    NSString* str=[NSString stringWithFormat:@"load('%@')",@"hi"];
    [web stringByEvaluatingJavaScriptFromString:str];
}

Hope that helps!





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.