Help - Search - Members - Calendar
Full Version: Embedded Firefox in Cocoa app
InsanelyMac Forum > Apple World > Mac Programming and Development
Zaiden
Hi! I've recently developed a fullscreen Cocoa app that has an embedded browser using WebView. The problem I have is that my client told me that the browser that is shown has to be firefox-compatible.

So, my question is: how do I include a firefox control (or something like that) in my Cocoa app, the way I did with WebView?

Thanks!
alloutmacstoday
[<your webView> setCustomUserAgent:@"Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7a) Gecko/20040614 Firefox/0.9.0+"

or w/e the new firefox user agent is
Zaiden
Correct me if i'm wrong... but i think the only thing that instruction would do is to make the website belive i'm using firefox. The problem I have is that I must use the firefox engine.
alloutmacstoday
Ohhhh!

Whoops!

Yeah, pretty much impossible...
bofors
This actually doesn't sound that hard to do, because it looks like others are doing it (apparently "Second Life" does) but I have yet to look at the Firefox code.

I think there is two ways to approach this:

(1) Try to use the Firefox source code as a framework that you link to and either access or create your own NSFireFoxWebView class, which of course would use the Gecko engine instead of WebKit.

or

(2) Launch Firefox invisibly in the background and Distributed Objects to take the Firefox NSView, put it into your application and sync it with the Firefox app running in the background.

I would post this question on Apple's "Cocoa-Dev", "Webkitsdk-dev" & "Web-dev" lists or better yet just ask the Cocoa Firefox developers what they recommend: http://lists.apple.com/mailman/listinfo
Zaiden
I've found something that might work here: http://www.artlogic.com/resources/embedding-mozilla/

This project is not approved yet, but I think it won't be too hard to get it done... If it gets approved, I'll continue researching.

Thanks!
bofors
QUOTE(Zaiden @ Aug 16 2008, 07:43 PM) *
I've found something that might work here: http://www.artlogic.com/resources/embedding-mozilla/

This project is not approved yet, but I think it won't be too hard to get it done... If it gets approved, I'll continue researching.


That embedding mozilla link looks good. This is approach (1) that outlined above, where you would be using their CHBrowerView (which I called NSFireFoxWebView).

Those instruction are over five years old, so you may have to tweak a couple of things to make it work 10.5 and you might want to eventually use up to date Firefox source code. But I would start by trying to make it work by following those instructions and using the old code.

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.