Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Opening and renaming multiple tabs from bookmarklet

24 views
Skip to first unread message

Johannes Bauer

unread,
Jul 19, 2012, 5:10:26 AM7/19/12
to dev-apps...@lists.mozilla.org
Hi list,

I'm currently trying to achieve a seemingly trivial task, but it just
won't work: I have a site that I want to be parsed by a bookmarklet.
>From the parsing result URLs (which may go offsite) and "captions" that
I would like to use for the appropriate "document.title"s (so they
appear in the caption). I've run into problems with that:

- Even if I allow the main site to open popups, this will only work up
until 20 tabs. After that, Firefox refuses to open new tabs. I'd need
30, sometimes 40, depending on the parsed site's content.
- Opening the different tabs from the bookmarklet is easy, modifying the
approproate window.document.title is not. I've tried to do it directly, like

newwin = open("foo.bar");
newwin.document.title = "foobar";

(which results in no result and no error message, even when I wait after
the open long enough that the document has really been parsed). I've
also tried placing the setting of the title in a timer callback (which
won't work for security reasons, it disallows accessing the remote
"document" property).

Is there a easy was to get this done? It seems like such a trivial task!

Best regards,
Joe

Boris Zbarsky

unread,
Jul 19, 2012, 10:59:22 AM7/19/12
to
On 7/19/12 5:10 AM, Johannes Bauer wrote:
> - Even if I allow the main site to open popups, this will only work up
> until 20 tabs. After that, Firefox refuses to open new tabs. I'd need
> 30, sometimes 40, depending on the parsed site's content.

Yes, there's a global cap on the number of popups untrusted code can
open. You can change the "dom.popup_maximum" preference to affect this.

> - Opening the different tabs from the bookmarklet is easy, modifying the
> approproate window.document.title is not. I've tried to do it directly, like
>
> newwin = open("foo.bar");
> newwin.document.title = "foobar";

Loads are async. You're changing the title of the about:blank document
that's initially in the window; then foo.bar loads and a new document is
created....

> I've also tried placing the setting of the title in a timer callback (which
> won't work for security reasons, it disallows accessing the remote
> "document" property).

Indeed.

> Is there a easy was to get this done? It seems like such a trivial task!

It is, for an extension. But you're trying to do it with script from a
web page, and there are some security restrictions on scripts in
webpages. ;)

You want to use an extension.

-Boris

Johannes Bauer

unread,
Jul 22, 2012, 4:48:55 PM7/22/12
to dev-apps...@lists.mozilla.org
On 19.07.2012 16:59, Boris Zbarsky wrote:

>> Is there a easy was to get this done? It seems like such a trivial task!
>
> It is, for an extension. But you're trying to do it with script from a
> web page, and there are some security restrictions on scripts in
> webpages. ;)
>
> You want to use an extension.

I did now, and after a bit of reading and playing around, it all works
very nicely. The plus side is that I can from the extension even use the
sqlite3 support that the Mozilla Storage facility offers, which makes
the whole thing even cooler than I originally indended.

Thanks the the hint in the right direction,
Best regards,
Joe
0 new messages