简体   繁体   中英

open a pop up on click of a link in uiwebview

I have uiwebview which loads a url. When user clicks on any link I want to open a popup window. I know I can detect link click by using following delegate method:

-(BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType

But the problem is that above delegate method is also being called when the viewcontroller is loaded. So the popup is generated on view load but it should open later when the link is clicked. I hope my problem is clear.

Regards
Pankaj

-(void)webViewDidStartLoad:(UIWebView *)webView   //WebUI
{
    NSLog(@"Web Page start loading.(Empty)");
}

This method called when a page start loading initially, So you can take advantage of it. This will call when user click a link, as it will try to load a page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM