I have a webview in which i'm opeing a url using:
[webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http:abs.com"]]];
Now on opening this url on the webview there is some option of playing video,i want to add a back button in the navigation bar when youtube url is clicked.
how can i do this.
this is my whole code:
-(void)loadwebview
{
[webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http:abc.com"]]];
// if([NSURL URLWithString:@"http://www.youtube.com/watch?v=47pwcfo9E_s"])
// if(youtubeurl)
NSURL* url1;
if ([url1.absoluteString isEqualToString:@"http://www.youtube.com/watch?c"])
{
NSLog(@"hello222");
}
}
- (void)webViewDidStartLoad:(UIWebView *)webView {
[self loadwebview];
}
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
// Here you can check the URL
NSURL *url = [request URL];
if ([url.absoluteString isEqualToString:@"http://www.youtube.com/watch?c"]) {
NSLog(@"string");
// Do something
return NO;
}
return YES;
}
