Launching new browser window from a custom WebKit browser view
My MacOsX has a Cocoa app with a special controller/window that employs WebKit for browsing. I just found out that the browsed content may have links that should open new browser windows. Although I set the following two declarations (see below) for my webView - nothing happens when I click those links with my specialized window. Clicking them from a regular browser would re-open a window:
[[_webView preferences] setJavaScriptEnabled:YES];
[[_webView preferences] setJavaScriptCanOpen开发者_JAVA百科WindowsAutomatically:YES];
Am I missing a callback implementation?
Make yourself the UI delegate:
[webView setUIDelegate:self];
And implement webView:createWebViewWithRequest:
. This method needs to create and return the new WebView
object and the window to display it. If you do not want to create the new view programmatically, you can use a NIB and load that instead.
精彩评论