Simply enough, I need to know how to obtain the current URL that the UIWebView is in. That way, I would be able to add such features as bookmarking, sharing, etc.
The crux of the question is, what can I do to obtain the current URL of the webvew?
EDIT: Solution:
NSString *currentURL = myWebView.request.URL.absoluteString;
NSString *currentURL = myWebView.request.URL.absoluteString;
[[[web request] URL] absoluteString]
Will give you the current url as a String.
In Swift if you need to get your URL you need to write this block of code:
func webViewDidFinishLoad(webView: UIWebView) {
let currentURL = webView.request?.mainDocumentURL
print(currentURL)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With