Slashdot Mirror


Embedding Mozilla in Mac OS X Cocoa Apps

JimCricket writes "Art & Logic has published a new article: Embedding Mozilla in Mac OS X Cocoa Apps . The author presents a detailed step-by-step guide for Mac OS X developers that want to use Mozilla within their applications."

49 comments

  1. Why not WebKit/KHTML? by foyle · · Score: 5, Insightful

    Why would you embed Mozilla, which is acknowledged to be bloated even by its supporters, instead of Apple's WebKit (based on KHTML, used in Safari)?

    WebKit Docs

    1. Re:Why not WebKit/KHTML? by Anonymous Coward · · Score: 0
      RTFA

      As long as I'm posting, what's up with the part about installing Fink? The article is new but the Fink part sounds like it was written a year ago.

    2. Re:Why not WebKit/KHTML? by Anonymous Coward · · Score: 0
      Why would you embed Mozilla, which is acknowledged to be bloated even by its supporters, instead of Apple's WebKit (based on KHTML, used in Safari)?

      Damn, you beat me to it. Can't think of any other on-topic responses to this proposition.

    3. Re:Why not WebKit/KHTML? by andrewl6097 · · Score: 1

      I'll be happier about KHTML when it can read www.iht.com. Mozilla really is about the best out there when it comes to page rendering, folks.

    4. Re:Why not WebKit/KHTML? by Anonymous Coward · · Score: 4, Informative

      Been a while since you checked out Safari, huh? iht.com, which was a pain in the ass for a long time, has been working for weeks now, since the late betas.

    5. Re:Why not WebKit/KHTML? by madamimadam · · Score: 1

      I just moved from being a Slashdot reader to someone with a username and password JUST so I could say exactly that.... turns out you more than easily beat me to it, though. LOL Mozilla is one of the last things I would want to be embedding into an application I write.

    6. Re:Why not WebKit/KHTML? by Senjaz · · Score: 2, Interesting

      The only reason I can think of is for visual HTML editors. They could embed both frameworks for previewing pages without having to load a separate browser.

      --
      Don't blame me - this .sig had steal me written all over it.
    7. Re:Why not WebKit/KHTML? by IamTheRealMike · · Score: 1

      Gecko/Moz has a lot more features. We embed IE in an app here at work because it has features we need. It's possible we might move to Gecko/Moz in the future, but KHTML is out of the question - we need things like in place editing, simple licensing, and behaviours/XBL.

  2. Web Core? by lnoble · · Score: 1

    Could this be done with Web Core as well? I assume it could be. What advantages would Gecko/Moz have over it? I don't really understand much of the technical mumbo jumbo in the article so any enlightenment would be great.

    It seems that the basic use for this would be to simply provide app support for all the basic web standards, but what other uses could it have?

  3. embed _Mozilla_, or Gecko? by Tumbleweed · · Score: 3, Insightful

    I don't even wanna know why you'd want to embed the whole frickin' browser in anything, rather than just the renderer. And if you're going to embed the renderer, then just use the system one in WebCore, based on the KHTML renderer.

    1. Re:embed _Mozilla_, or Gecko? by Quixotic+Raindrop · · Score: 3, Insightful

      Actually, one reason _not_ to use WebCore is that it doesn't handle quite a number of websites using authentication now, which tells me that their authent package is broken (or, simply behind). IIRC, Safari uses webcore, and has tremendous difficulty (even yet) with e-commerce and online banking sites. Mozilla/Mac OS X is able to connect to these sites, and I assume would be a better choice for secure connections (whether Gecko or Mozilla itself).

      --
      Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. (Einstein)
    2. Re:embed _Mozilla_, or Gecko? by Tumbleweed · · Score: 1

      The site also mentioned a question as to whether WebCore is javascript-enabled, and I must say, I don't know the answer to that question, either.

    3. Re:embed _Mozilla_, or Gecko? by nitehorse · · Score: 4, Informative

      Of course WebCore is JavaScript-enabled.

      Or haven't you heard of JavaScriptCore? It's a part of WebCore.

    4. Re:embed _Mozilla_, or Gecko? by Tumbleweed · · Score: 0, Offtopic

      Nope, the last time I really paid attention to WebCore, it had just been announced. I'm not (yet) on OS X. Gotta save up a lotta $ first for that dual-proc G5! I'm also learning C(99) in preparation to moving to Objective-C once I get the new machine. Sadly, it will be many moons before I can afford said new machine. :(

    5. Re:embed _Mozilla_, or Gecko? by megabulk3000 · · Score: 5, Interesting

      Sure, check this article for instructions on how to make a one-line-of-code web browser in Cocoa using WebCore (and the comment at the bottom of the article which tells how to make a no-line-of-code browser!)

    6. Re:embed _Mozilla_, or Gecko? by germuska · · Score: 2, Insightful
      Quixotic Raindrop wrote:
      Safari uses webcore, and has tremendous difficulty (even yet) with e-commerce and online banking sites.

      I use Safari all day every day, including for online banking and plenty of ecommerce, and I don't have any consistent problems.

      Furthermore, using the CocoaDev One Line Browser, I was able to login to my bank site and view my pending bill payments (https) as well as login to a site which uses HTTP basic auth without writing a single line of extra code.

      What are these problems you report with Safari and authentication?
    7. Re:embed _Mozilla_, or Gecko? by Quixotic+Raindrop · · Score: 1

      I have entered several bugs with Safari regarding online banking or other authentication. For example, Safari does not correctly handle logging into thinkgeek.com. I don't trust you enough to tell you what banks I have accounts with, but there are at least five with which I can do business in either IE 5.2 or Mozilla, but cannot if I use Safari.

      --
      Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. (Einstein)
    8. Re:embed _Mozilla_, or Gecko? by davebo · · Score: 1

      My example: I can't log on to my school's wireless network with Safari (via https). I have to use Camino or Moz.

      Why? Beats me. But it's true. With Safari 1.0.

    9. Re:embed _Mozilla_, or Gecko? by germuska · · Score: 2, Insightful

      I certainly didn't mean to suggest that Safari was incapable of bugginess.

      In your case, do you have the security preference "accept cookies" set to "only from sites you navigate to"? I've found that that setting doesn't play well with single-sign-on type systems where you (sometimes invisibly) bounce around from the initial server you visit to an auth server and back.

      Then again, I have also found that Safari has some problem with regular cookies set by the SnipSnap blog/wiki application (ultimately set by the Jetty servlet container).

      I still think it's pretty cool that WebCore itself can do all those basic browser functions, including (i forgot to mention) consulting the OS X Keychain for my saved password for the basic auth site I tested.

    10. Re:embed _Mozilla_, or Gecko? by Anonymous Coward · · Score: 0

      You can't really have been paying attention: WebCore and JavaScriptCore were released together.

      Sucks that you got modded offtopic though.

    11. Re:embed _Mozilla_, or Gecko? by davebo · · Score: 1
      In your case, do you have the security preference "accept cookies" set to "only from sites you navigate to"?

      Why yes, yes I do. I'll have to give you suggestion a try. Thanks!

  4. Why? by xyrw · · Score: 1

    I read the article, but don't understand why it would be necessary to embed a whole browser. Why not just the rendering engine? Wouldn't embedding Mozilla create a lot of overhead?

  5. READ THE ARTICLE by Anonymous Coward · · Score: 2, Informative

    the answer to your "question" is in the FIRST SENTANCE of the article.

    1. Re:READ THE ARTICLE by WatertonMan · · Score: 1

      The first sentence reads, "Embedding Mozilla" can mean many things." How does that answer his question?

    2. Re:READ THE ARTICLE by Anonymous Coward · · Score: 0

      You're a fucking tit.

      The article writers obviously don't understand the first thing about the differences between Camino and WebCore. Otherwise the phrase:

      which will purportedly make embedding a browser as simple or simpler than the procedure detailed in this document

      would read:

      which will shit all over the crufty, bloated shite detailed in this document

  6. READ THE ARTICLE by Anonymous Coward · · Score: 0

    i know reading sure is tough, but it prevents you from looking like a fricken moron.

  7. READ THE ARTICLE by Anonymous Coward · · Score: 0

    come on, its just a click away... all of your "questions" were indeed what the article talks about. jesus.

  8. Ummm... by Tyrdium · · Score: 1

    Why embed all of Mozilla? I'm positive that for most of these apps, all that would be needed is Firebird...

    1. Re:Ummm... by MochaMan · · Score: 0

      +1 Funny

  9. Re:the point is this... by Anonymous Coward · · Score: 3, Insightful

    most of the "kruft" that has "bloated" gecko is in fact the kind of support code that's slowly being added by apple to kthml to get it to support the *REAL* web.

    Huh? No, Gecko is over 1 million lines of code, more than 10 times the size of KHTML. Most of that is stuff like their own string and basic container classes. (Why do people feel compelled to write THEIR OWN fundamental library classes? It boggles.)

    but just around the corner there are *hundreds* of other sites, already workin in gecko mind you, that kthml is going to have to hack around

    Hundreds? Doubtful.

    its horribly naive to think that in 1 years time when khtml comes close to approaching where gecko is *now* (not to mention where gecko will be in 12 months) that khtml will still be as light and clean as it is now

    Except that KHTML is already superior to Gecko NOW. You seem to have missed that little tidbit.

  10. Silly unless you want to make your own browser.. by Steveftoth · · Score: 4, Insightful

    For most programmers, we are just looking for a way to embed a small HTML rendering system so that we can display documentation, help, or someother hyperlinked document. Quickly too, so that we can easily get back to making a quality application. Gecko is a huge project and if you want to use it as the basis for an application more power to ya.

    However, Apple has the edge here with WebCore, you can now make a generic web browser without a single line of C/C++/ObjC code. Using only project builder, Interface Builder and WebCore, you can create a custom browser. It won't have many options, but it's quick and easy. Takes like 10 minutes to get working if you have all the tools installed.

  11. um... no by Anonymous Coward · · Score: 0

    "Except that KHTML is already superior to Gecko NOW. You seem to have missed that little tidbit." sorry pal, you need to do some more research.

  12. Re:the point is this... by madamimadam · · Score: 5, Interesting

    You seem to be forgetting the VITAL point that Apple REFUSES to release a new version of Safari, and therefore the WebKit, if it is at ALL slower that the previous version. This is a definate fact that Apple hangs on to dearly and could be why there are still a few places that they need touching. As per WWDC, sometimes coders kind of cheat by optimising another part of the code so that their new code does not slow down the browser but as long as the end result is that the new build runs at least as fast as the previous build, Apple will release it. If it is at all slower than the previous build, Apple refuses to let it out of the closet.

  13. One would want cross-platform solutions by Anonymous Coward · · Score: 3, Informative

    Safari ain't the bee's knees as far as I'm concerned, although I'm using it right now. It's got lots of advantages, sure, but it's still not handling as many pages as Mozilla for OSX. Mozilla 1.4 is fast and stable, and runs on almost everything. Safari is fast and stable and you need to be running OSX to use it.

    Explorer is the world-wide de facto standard right now; it's a bad browser with a lot of propritary drek in it, and much more coming down the line, including possibly a subscription service. Why not embed Mozilla in everything? Since it's cross-platform, open source, and pretty good?

    How would you rather do your online banking five years from now?

    A) With Windows, which charges you $1,000 a month just for the right to use Explorer?

    B) With Safari, which comes with a $25,000 entry-level iMac?

    C) With Mozilla, which is free, and which will run on almost anything?

    Mozilla isn't the be all and end all of browsers, but it's cross-platform, open-source, and runs all right. Nothing to sneeze at.

    1. Re:One would want cross-platform solutions by Arandir · · Score: 2, Insightful

      Ummm, this article is about embedding Mozilla in a Cocoa application. So you need an entry-level Mac to begin with in order to use it.

      --
      A Government Is a Body of People, Usually Notably Ungoverned
  14. Vaguely related note: Embedding SDL in Cocoa Apps by follower-fillet · · Score: 3, Informative

    I noticed recently that there's work going on to embed SDL in Cocoa Apps, here's a link to some sample code:

    "Mac OS X Cocoa Integration Patch and Sample Code"

    http://www.libsdl.org/pipermail/sdl/2003-July/05 54 35.html

    In theory, with this in place I believe it should also be possible to embed SDL in Mac OS X wxWindows apps, once the 'GetHandle' functionality is implemented there.

  15. Re:the point is this... by capmilk · · Score: 1

    You got any proof of this?
    I mean yes, it could be a likely situation, considering how Apple boasts Safari's speed. But then again, it could also be just speculation...

  16. Camino by mbbac · · Score: 2, Insightful

    That's kind of the whole point of the Camino Project. Why reinvent the wheel?

    --

    mbbac

  17. Re:the point is this... by Anonymous Coward · · Score: 1, Informative

    they explicitly said this at WWDC. Of course, the parent poster ignores the fact that they said they also run compatibility tests on all of the builds, including tests that are more stringent than some of the publicly available tests. I doubt they would break things with their "optimizations" as a result... a broken browser is worse than a slow one.

  18. Re:the point is this... by Senjaz · · Score: 1

    I remember reading this too, it could have been from Dave Hyatt's 'blog but I can't be sure. As a source of info on Safari it's reliability is as good as anything direct from Apple him being one of the Safari code team et. al.

    --
    Don't blame me - this .sig had steal me written all over it.
  19. Re:the point is this... by davebo · · Score: 1

    Yes, the string and container classes are pretty goofy. "Oh no, OpenVMS doesn't have a .rot13 method on it's string class - guess we'll have to implement strings from scratch in Mozilla for every platform"

    But - as to *hundreds* of sites with problems - I have ~60 bookmarks. 3 of them are rendered oddly in Safari compared with Moz/Camino. So hundreds doesn't seem that unreasonable.

    Apple has made some nice contributions to KHTML - but there are still some problems when it comes to standards support that Gecko doesn't have.

  20. Yet Another Person who didn't read the article by Rubel · · Score: 1

    The article isn't about reinventing the wheel. It's about using (dare I say leveraging) Chimera/Camino in other Cocoa apps.

  21. After reading.. by Anonymous Coward · · Score: 0

    After reading all the comments here I think it's safe to say that mozilla on OS X sux and safari is da shit.

    Quite strange as mozilla is quite competent on every other platform.

  22. no no... i'm fucking your mom's tits by Anonymous Coward · · Score: 0

    i know its easy to get confused