I am working in iPhone application, Using Webview to load Addvertisement in bottom of the screen and its working fine, i want to when the user select the WebView, its automatically goes to browser and load in iPhone device, How to integrate this? please help me
Thanks in Advance
I tried this:
- (void)viewDidLoad
{
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 430, 320, 50)];
[webView setDelegate:self];
NSString *urlAddress = @"http://www.dasfafa./myadds.html";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
[self.view addSubview:webView];
}
-(void)webViewDidStartLoad:(UIWebView *)webView
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
}
-(void)webViewDidFinishLoad:(UIWebView *)webView
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
NSString *currentURL = self.AddvertiseWebView.request.URL.absoluteString;
NSLog(@"currentURL:%@",currentURL);
}
Here code showing you how to open a link in Safari when clicked on in your UIWebView. The method shouldStartLoadWithRequest is a delegate method that is called when a link is clicked on. You can override the method and tell it to open in Safari.
or Try this