Browser Window inside Cocoa application

ronenmagid1
ronenmagid1 used Ask the Experts™
on
As I'm new to Mac programming, I'd appreciate any pointers.

I have a URL in my Mac Cocoa Application - I'd like to embed a browser in my own NSWindow and launch that URL in it.

In windows, it's pretty easy as you can embed the IE control.

Is there something similar for Mac?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Easier.
WebKit:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/DisplayWebContent/Concepts/WhyWebKit.html#//apple_ref/doc/uid/20002023-CJBEJBHH

WebView:
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/WebKit/Classes/WebView_Class/Reference/Reference.html

Actually:

#import
#import

- (void)awakeFromNib
{
 WebFrame *mainFrame = [webview mainFrame];
 NSURL *url = [NSURL URLWithString:@"http://www.apple.com"];
 NSURLRequest *request = [NSURLRequest requestWithURL:url];
 [mainFrame loadRequest:request];
}

A bit more complicated stuff:

Check CallJS sample and SimpleController.m:
http://developer.apple.com/mac/library/samplecode/CallJS/Listings/SampleController_m.html#//apple_ref/doc/uid/DTS10004241-SampleController_m-DontLinkElementID_4

A Cocoa application driven by HTTP data
http://cocoawithlove.com/2008/09/cocoa-application-driven-by-http-data.html

In case you need it for iPhone:
iPhone SDK Tutorial: Build your very own Web Browser!
http://dblog.com.au/iphone-development/iphone-sdk-tutorial-build-your-very-own-web-browser/

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial