[Greasemonkey] Closing firefox tabs
Dave Land
land at aol.com
Tue Jun 20 10:44:14 EDT 2006
On Jun 20, 2006, at 2:20 AM, Steve Randles wrote:
> Hi all,
>
> I've just subscribed to the list to see if I can alter a userscript
> that I
> already have.
>
> What I want to be able to do is to simply close the firefox tab
> when the
> "buy" button is clicked, so that I buy and then the tab goes away.
>
> I have some scripting knowledge (various types) and want to know
> what I need
> to do, to get this done.
>
> Can anyone help?
Maybe...
Scripts are prevented from using window.close() to dismiss windows
that they did not open to prevent script kiddies from maliciously
closing your windows for you...
On the other hand, top.close() seems to do the trick.
I suppose the general model, then, would be to write a GM script that
detects the page that is returned in response to a successful "buy"
button click, and execute top.close().
I am sorry that I didn't take the time to write a script that does
this — but I did want to pass along a little experience from a guy
who found that window.close() merely logs "Scripts may not close
windows that were not opened by script."
Good luck with your new script!
Dave
More information about the Greasemonkey
mailing list