Re: Clicking links in webview does nothing
Re: Clicking links in webview does nothing
- Subject: Re: Clicking links in webview does nothing
- From: Jens Alfke <email@hidden>
- Date: Sun, 30 May 2010 09:47:55 -0700
On May 30, 2010, at 5:00 AM, Nava Carmon wrote:
> I have a webView in my cocoa application. For some reason clicking on hyperlinks there does nothing. I created it in IB and it loads and show the remote html properly. When I roll over links, the cursor changes to hand, but when i click on them nothing happens.
I’m guessing that the page’s HTML specifies that the links should open in a new window. The WebView can’t do that itself, so it calls a delegate method to tell you to create a new window. If you haven’t implemented that delegate method, nothing happens. I can’t remember offhand which of the many WebView delegate APIs it is; look through them in the reference and it should be pretty clear which one.
> Actually I'd like to open them in default browser window. What is the way to do that?
It’s trivial: the delegate method will hand you an NSURL, so just tell NSWorkspace to open it for you.
—Jens_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden