PDA

View Full Version : how to get notified when webview finished loading




DavidBlack
Jun 16, 2013, 09:06 AM
Ok I want to know when my webview which is name youtubewebviewview to know when it's finish loading. I am using this code from apple but it seem like it's not getting called I used break points to make sure.

- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame
{
// Only report feedback for the main frame.
if (frame == [sender mainFrame]){
NSString *url = [[[[frame provisionalDataSource] request] URL] absoluteString];
[textField setStringValue:url];
}
}



Red Menace
Jun 16, 2013, 10:16 AM
Take a look at webView:didFinishLoadForFrame (https://developer.apple.com/library/mac/#documentation/cocoa/Reference/WebKit/Protocols/WebFrameLoadDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/webView:didFinishLoadForFrame:)

Meir David
Jun 26, 2013, 06:25 AM
hi dude

Here is a code for you

Just implement WebViewClient and extend onPageFinished() as follows:



mWebView.setWebViewClient(new WebViewClient() {

public void onPageFinished(WebView view, String url) {
// do your stuff here
}
});

chown33
Jun 26, 2013, 02:09 PM
hi dude

Here is a code for you

Just implement WebViewClient and extend onPageFinished() as follows:

mWebView.setWebViewClient(new WebViewClient() {

public void onPageFinished(WebView view, String url) {
// do your stuff here
}
});

This is completely wrong.

The question was asked in Objective-C. This "answer" is in Java, most likely for Android, since WebViewClient seems to be android.webkit.WebViewClient.

DavidBlack
Jun 28, 2013, 03:07 PM
This is completely wrong.

The question was asked in Objective-C. This "answer" is in Java, most likely for Android, since WebViewClient seems to be android.webkit.WebViewClient.

I have figured this out a long time ago but thanks for the help :). That Objective C book is helping me understand the concept much better :). :cool: