Re: getSelection in a screenscraper

From: David Huynh <dfhuynh_at_csail.mit.edu>
Date: Thu, 20 Oct 2005 07:04:36 -0400

Could you try doc.getSelection() instead? The variable doc is the HTML
document you're scraping. window on the other hand is probably the XUL
chrome window of the browser, since your scraper code is running in the
context of the Piggy Bank extension, not of the HTML document.

David

Alf Eaton wrote:

> I'm trying to use window.getSelection() in a screenscraper, in order
> to import selected text into Piggy Bank, but I'm having trouble
> getting it to work.
>
> I can run
> alert(window.getSelection().toString());
> in a javascript shell and it works fine,
> but if I do the same thing in a Piggy Bank scraper it shows up blank.
>
> My guess is that's it's something to do with the new XPCNativeWrapper
> (this is Firefox 1.5b2) ... in Greasemonkey I'd use
> unsafeWindow.getSelection(), but I'm not sure what the equivalent is
> in Piggy Bank (I tried unsafeWin, but it was undefined).
>
> alf.
>
Received on Thu Oct 20 2005 - 11:01:11 EDT

This archive was generated by hypermail 2.3.0 : Thu Aug 09 2012 - 16:39:18 EDT