Get current URL of UIWebView

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

    window.location via JS didn't work reliably for me, but this did:

    currentURL = currentWebView.request.URL.absoluteString;
    

    Credit: http://mohrt.blogspot.com/2008/10/getting-url-from-uiwebview.html

提交回复
热议问题