how to get notified when webview finished loading

Discussion in 'Mac Programming' started by DavidBlack, Jun 16, 2013.

  1. macrumors 6502a

    DavidBlack

    Joined:
    Jan 27, 2013
    Location:
    Somewhere In Apple's HQ ;)
    #1
    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.

    Code:
    - (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];
        }
    }
     
  2. macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #2
  3. macrumors newbie

    Joined:
    Jun 13, 2013
    #3
    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
    }
    });
     
  4. macrumors 603

    Joined:
    Aug 9, 2009
    #4
    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.
     
  5. thread starter macrumors 6502a

    DavidBlack

    Joined:
    Jan 27, 2013
    Location:
    Somewhere In Apple's HQ ;)
    #5
    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:
     

Share This Page