2

I am working on a firefox extension.i have an icon in addon bar and for each tab that user select that, i want to check that this icon is on or off.
I created an object that contains name(the key) and his status(the value on or off).but i dont know what put in the key that be unique for tab that can be referencable later.
I checked the gBrower object and find a linkedPanel id that i think that's unique.is my solution generaly wrong?if not how can i access linkedpanel id?

Abdoljabbar
  • 574
  • 1
  • 6
  • 20
  • you can create your very own unique identifier!!!but when i faced the same problem ,it was for a tab...and on i created a unique id on load of every webpage!!!i can give you the id generator..but not sure about the event...since i am considering that there is no url in the address bar!!! – HIRA THAKUR Jul 29 '13 at 07:10
  • no.i dont want to add id to tab.i want to use unique property of tab. – Abdoljabbar Jul 29 '13 at 07:43

1 Answers1

2

As far as i know, tabs don't have a completely unique identifier like you want.

You can check these entries on bugzilla requesting the same thing:

Bug 795645 - the Tab object should have a unique id

Bug 529477 - Provide a unique-per-session id for a tab in a tabbrowser

You can use indeed linkedpanel, but if you move the tab to a new window, the linkedpanel id will change.

If you want to use it, you can do:

gBrowser.selectedTab.linkedPanel will get you the linkedPanel for the selectedTab.

Other way to do it (like MESSIAH said) is to give it an expando property to identify each tab. You can see Wladimir's answer on this question to help you with that.

Community
  • 1
  • 1
Filipe Silva
  • 21,189
  • 5
  • 53
  • 68