Reputation: 3653
I have an UIWebView
in my app. It loads some html page. In that html page has a button. When user click on that it redirects to another html page.If that new page is success page I want to do something in my app. How can I identify the redirecting url within my app.
Please help me. Thanks
Upvotes: 0
Views: 3287
Reputation: 24714
You can get the url in this delegate method shouldStartLoadWithRequest
,for example
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType{
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
if ([request.URL.path isEqualToString:@"Your successurl"]) {
//Do something
}
}
return true;
}
Upvotes: 0
Reputation: 801
UIWebView
have delegate methods to get the URL what it loads.
-(void)webViewDidStartLoad:(UIWebView *)webView
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
Try these methods
Upvotes: 4