Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get current URL of UIWebView

I already tried getting the current URL of my UIWebView with: webview.request.URL. Unfortunately the NSURL was empty. Anything wrong here? I am working with Xcode 3.2.2 beta 5.

The code above should be executed in the UIWebView delegate didStartLoad.

like image 741
danielreiser Avatar asked Mar 22 '10 10:03

danielreiser


1 Answers

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

like image 139
Matt Andersen Avatar answered Sep 28 '22 03:09

Matt Andersen