Skip to content Skip to sidebar Skip to footer

How To Detect When A Cordova Webview Completely Finished Loading?

I have embedded cordova webview. and then I have called javascript from native like below. [self.viewView stringByEvaluatingJavaScriptFromString: jscode]; but it is not performi

Solution 1:

When the html is loaded, a notification is posted. You can listen to it with this code:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad) name:CDVPageDidLoadNotification object:self.webView];

Then, when the notification is received, the pageDidLoad method will be called, put your code there

- (void)pageDidLoad
{
    NSString * jscode = @"some js code here";
   [self.viewView stringByEvaluatingJavaScriptFromString: jscode];
}

Post a Comment for "How To Detect When A Cordova Webview Completely Finished Loading?"