non-gui usage of Gtk2::MozEmbed



Hello,

Can someone please advise me on Gtk2::MozEmbed - can I use it in "standalone" way, without adding to window?
I'm experimenting with simpliest case, like here:

#!/usr/bin/perl

use Glib qw(TRUE FALSE);
use Gtk2 -init;
use Gtk2::MozEmbed '0.04';
use Mozilla::DOM '0.18'; # for NSHTMLElement



my $embed = Gtk2::MozEmbed->new();

$embed->signal_connect(net_stop => sub {
print "Callback called";
Gtk2->main_quit;
return FALSE;
});


$embed->load_url("http://ya.ru");

print "Starting mainloop\n";
Gtk2->main();

and it seems the callback is never get called, meanwhile this variant works:

#!/usr/bin/perl


use Glib qw(TRUE FALSE);
use Gtk2 -init;
use Gtk2::MozEmbed '0.04';
use Mozilla::DOM '0.18';   # for NSHTMLElement

my $window = Gtk2::Window->new ('toplevel');
my $embed = Gtk2::MozEmbed->new();

$embed->signal_connect(net_stop => sub {
      print "Callback called";
    Gtk2->main_quit;
    return FALSE;
});

$embed->load_url("http://ya.ru");
   
print "Starting mainloop\n";   

$window->add($embed);
$window->show_all;

Gtk2->main();


I'm trying to create a server-side rendering service for search-engines spiders, which cannot execute _javascript_. And I need to somehow extract innerHTML of the page (including html produced by _javascript_) in "non-gui" way, in the web-application's controller.

Best regards, Nickolay


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]