Is it possible to start an event when an UIWebView (Iphone) has finished loading the URL.
How can I find out, the current URL of the UIWebView?
Yes, that's possible. Use the UIWebViewDelegate
protocol and implement the following method in your delegate:
- (void)webViewDidFinishLoad:(UIWebView *)webView
If you want the URL, you can get the last request using the property request
:
webView.request.URL
None of the found solutions worked for me.
Then I found this example which at least works much better than any other solution I found on Google/StackOverflow.
uiwebview-load-completion-tracker
Very simple method:
Step 1: Set delegate UIWebViewDelegate
in header file.
Step 2: Add following webViewDidFinishLoad
method to get current URL of webview
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
NSLog(@"Current URL = %@",webView.request.URL);
//-- Add further custom actions if needed
}
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