Get current URL of UIWebView

后端 未结 14 1948
天命终不由人
天命终不由人 2020-11-29 16:08

I already tried getting the current URL of my UIWebView with: webview.request.URL. Unfortunately the NSURL was empty. Anything wrong h

14条回答
  •  春和景丽
    2020-11-29 16:44

    here's the code I use to grab the url every time you navigate to a different link within the webview:

    - (void)webViewDidFinishLoad:(UIWebView *)aWebView
    {
      self.url = aWebView.request.mainDocumentURL;
    }
    

提交回复
热议问题