On Sun, Oct 30, 2011 at 09:47:49PM +0000, Jörg Sommer wrote:
> Hallo John,
> 
> "John J. Foerch" <[email protected]> wrote:
> > On Tue, Oct 25, 2011 at 07:50:04PM +0000, Jörg Sommer wrote:
> >> Hi,
> >> 
> >> when I run
> >> 
> >> % conkeror -q -E 'add_hook("current_content_buffer_finished_loading_hook",
> >>   function (buffer) { dumpln("content loaded"); });'
> >> 
> >> and open the link “reading the tutorial” on the startup page with
> >> follow-new-buffer-background I only see the “content loaded” line for the
> >> startup buffer, but not for the new buffer. Doesn't this hook fire for
> >> background buffer?
> >
> > Correct.  The current_content_buffer_*_hook hooks only fire for a buffer
> > when it is the current buffer.  You want 
> > content_buffer_finished_loading_hook.
> 
> Thanks. Is there a hook that is better suited to modify the HTML? I'm
> setting buffer.document.documentElement.lang for a site that doesn't set
> it.
> 
> add_hook("content_buffer_finished_loading_hook",
>   function (buffer)
>   {
>       if (buffer.document.domain == 'lwn.net')
>           buffer.document.documentElement.lang = 'en';
>   });

buffer_loaded_hook runs as soon as the main document is finished loading,
before any embedded documents, images, or objects are finished.  It runs
for all buffers, not just content-buffers, so you should dispatch on
(instanceof content_buffer).

-- 
John Foerch
_______________________________________________
Conkeror mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/conkeror

Reply via email to