Opening links but not iFrames in webview

I have a webView in a Cocoa app that I am modifying programmatically. What I wanted to do was have open links open in the users browser by default, so I added code at the bottom of this question. It works fine, but if there is an iFrame on the page being loaded, it will open the iFrame content in the default browser and not display the frame correctly in my application. Is there a way to tell the web chat to open links but do nothing for the iFrames?

- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation
        request:(NSURLRequest *)request
          frame:(WebFrame *)frame
decisionListener:(id)listener 
{

    // Open it in the default browser
    NSURL *url = [request URL];
    if (url)
    {
        [[NSWorkspace sharedWorkspace] openURL:url];
        [listener ignore];
    }
    else
    {
        [listener use];
    }
}

      

0


a source to share


1 answer


Study the dictionary of navigation actions .



0


a source







All Articles