Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Getting URIs of open tabs
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Matthew Smith  
View profile  
 More options Nov 6 2006, 9:35 pm
Newsgroups: mozilla.dev.tech.xul
From: Matthew Smith <m...@kbc.net.au>
Date: Tue, 07 Nov 2006 13:05:12 +1030
Local: Mon, Nov 6 2006 9:35 pm
Subject: Getting URIs of open tabs
Hi

I am trying to take a snapshot of all tabs in Firefox, but am having
problems working out how to access the URIs of all the pages.

So far, I have managed to get the labels of all the tabs:

var tabs=gBrowser.tabContainer.childNodes;
for(var i=tabs.length - 1; i>=0; i--)
{
        alert(tabs[i].getAttribute('label'));

}

How do I get the URIs?  Elements of type tab inherit the uri attribute
from the XUL element, but it just comes up blank.

Cheers

M

--
Matthew Smith
IT Consultancy & Accessible Web Application Development
Business: http://www.kbc.net.au/
Personal: http://www.smiffysplace.com/
LinkedIn: http://www.linkedin.com/in/smiffy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil  
View profile  
 More options Nov 7 2006, 6:43 am
Newsgroups: mozilla.dev.tech.xul
From: Neil <n...@parkwaycc.co.uk>
Date: Tue, 07 Nov 2006 11:43:08 +0000
Local: Tues, Nov 7 2006 6:43 am
Subject: Re: Getting URIs of open tabs

Matthew Smith wrote:
>I am trying to take a snapshot of all tabs in Firefox, but am having problems working out how to access the URIs of all the pages.

You should look at the way the "Bookmark this group of tabs" code works
(sorry I don't have a link).

--
Warning: May contain traces of nuts.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matthew Smith  
View profile  
 More options Nov 7 2006, 11:44 pm
Newsgroups: mozilla.dev.tech.xul
From: Matthew Smith <m...@kbc.net.au>
Date: Wed, 08 Nov 2006 15:14:39 +1030
Local: Tues, Nov 7 2006 11:44 pm
Subject: Re: Getting URIs of open tabs
Quoth Neil at 11/07/06 22:13...

> Matthew Smith wrote:

>>I am trying to take a snapshot of all tabs in Firefox, but am having problems working out how to access the URIs of all the pages.

> You should look at the way the "Bookmark this group of tabs" code works
> (sorry I don't have a link).

I was unable to find it in the browser source, although found a few
clues which, with DOM inspector got the answer:

// Get browsers object
var browsers=document.getElementById('content').browsers;
var numBrowsers=browsers.length;

        for (var i=0; numBrowsers>i; i++)
        {
                var thisURI=browsers[i].currentURI.spec;
                // do something with it.
        }

Cheers

M

--
Matthew Smith
IT Consultancy & Accessible Web Application Development
Business: http://www.kbc.net.au/
Personal: http://www.smiffysplace.com/
LinkedIn: http://www.linkedin.com/in/smiffy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil  
View profile  
 More options Nov 8 2006, 5:31 am
Newsgroups: mozilla.dev.tech.xul
From: Neil <n...@parkwaycc.co.uk>
Date: Wed, 08 Nov 2006 10:31:29 +0000
Local: Wed, Nov 8 2006 5:31 am
Subject: Re: Getting URIs of open tabs

Matthew Smith wrote:
>// Get browsers object
>var browsers=document.getElementById('content').browsers;
>var numBrowsers=browsers.length;

>    for (var i=0; numBrowsers>i; i++)
>    {
>            var thisURI=browsers[i].currentURI.spec;
>            // do something with it.
>    }

You can get the titles too using .contentTitle which would save you a step.

--
Warning: May contain traces of nuts.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matthew Smith  
View profile  
 More options Nov 8 2006, 6:13 pm
Newsgroups: mozilla.dev.tech.xul
From: Matthew Smith <m...@kbc.net.au>
Date: Thu, 09 Nov 2006 09:43:14 +1030
Local: Wed, Nov 8 2006 6:13 pm
Subject: Re: Getting URIs of open tabs
Quoth Neil at 11/08/06 21:01...

>>// Get browsers object
>>var browsers=document.getElementById('content').browsers;
>>var numBrowsers=browsers.length;

>>        for (var i=0; numBrowsers>i; i++)
>>        {
>>                var thisURI=browsers[i].currentURI.spec;
>>                // do something with it.
>>        }

> You can get the titles too using .contentTitle which would save you a step.

In this instance, I just need the URIs.  This is a new part of my
WebSticky[1] project, similar to "bookmark group of tabs".  We retrieve
the URIs of all open tabs, turn them into an XML string, then POST it to
the server.  We can then reverse the process to restore the snapshot.

As this is a client/server model, one can snapshot the tabs on one
computer (say work), then restore them on another computer (say home).

Cheers

M

1 - http://www.websticky.net

--
Matthew Smith
IT Consultancy & Accessible Web Application Development
Business: http://www.kbc.net.au/
Personal: http://www.smiffysplace.com/
LinkedIn: http://www.linkedin.com/in/smiffy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »