Get current URL of UIWebView

后端 未结 14 1981
天命终不由人
天命终不由人 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:30

    Tried this for google search results on iPhone:

     NSString* currentURL = webView.request.URL.absoluteString;
     NSString* mainDocumentURL = webView.request.mainDocumentURL.absoluteString;
    

    Both return the same string!

提交回复
热议问题