Re: getSelection in a screenscraper

From: Alf Eaton <lists_at_hubmed.org>
Date: Thu, 20 Oct 2005 14:42:26 -0400

That did the trick - I'd tried document, but not doc. I've updated my
Google Map scraper to work with the new Google Local format:
http://alf.hubmed.org/scrapers/

alf.

On 20 Oct 2005, at 07:04, David Huynh wrote:


> 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 - 18:37:09 EDT

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