I already tried getting the current URL of my UIWebView
with: webview.request.URL
.
Unfortunately the NSURL
was empty. Anything wrong h
I use the shouldStartLoadWithRequest
event (UIWebViewDelegate) to catch URL updates. request.mainDocumentURL.absoluteString
will get you the main web page's URL (which is normally what you want), while request.URL.absoluteString
will include CSS and JavaScript includes.
As UIWebView is deprecated, for WKWebview to get the current url is very simple.
webView.url