[Mono-list] Gecko-sharp question (seek examples) handles to content

Michael Hutchinson m.j.hutchinson at gmail.com
Sun Jul 26 01:26:46 EDT 2009


On Sat, Jul 25, 2009 at 2:09 PM, ted leslie<tleslie at tcn.net> wrote:
> I have a need to use gecko-sharp to display some web content in an app.
>
> I want to access some of that web content,
> for example, like one would with java script in the page,
> to manipulate, even do ajax type things, and beyond,
> but I would like to code it in c# in the app,
> in other words I just want the handles to the
> content that gecko is rendering (and perhaps
>  fire/control redrawing).
> I assume this is doable, are there any good examples
> of this (in c#/mono), or failing that some reasonable starting point?

Unfortunately there is no C# DOM wrapper for either Gecko# or WebKit.
AFAIK there is one there is for Mono's WinForms web control
(gluezilla), so it could perhaps be adapted for Gecko#. It might even
be possible to use gluezilla as the basis of a GTK# control, skipping
gtkmozembed entirely.

Back in 2005, before Webkit-GTK or mozembed existed, AspNetEdit (an
ASP.NET editor) did Gecko# C#<->JS interop this very effectively using
a horrible hack - message-passing between C# and JS, using the status
bar and the URL string. As far as I know, this still works. You can
find the code in Mono SVN:
http://anonsvn.mono-project.com/viewvc/trunk/jscall-sharp/
I recommend copying the C# files into your app instead of building as
a separate library.

> Also, how well would this work on Windows at this time
> (i.e. gecko-sharp, and xul, and libgtkembedmoz and such)?

Gecko# worked pretty well on Windows last time I tried - but that was
2005. I don't think there have been any newer builds since then, but
if you could find the old installers, they'd probably still work.

I know this is a weak point in the cross-platform GTK# story, but
getting a cross-platform web browser control that can integrate with
GTK is quite difficult. Mozilla/Gecko doesn't make embedding easy at
the best of times, and is only designed to use GTK on Unix/Linux.
Going forwards, Webkit-GTK is probably better.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Mono-list mailing list