I need identify windows that are opened via menu:
File > New window in the firefox browser. MDN give us a solution in Uniquely identifying DOM windows. Basically:
var util = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
var windowID1 = util.outerWindowID;
var windowID2 = util.currentInnerWindowID;
alert("outerWindowID: \t\t\t" + windowID1 + "\ncurrentInnerWindowID: \t" + windowID2);
Investigating the interface definition:
currentInnerWindowID: The ID of the window's current inner window.
outerWindowID: The ID of the window's outer window. Read
Pretty clear but still I can't decide which is more appropriate to identify a window opened via menu.
Here an extract of Inner and outer windows (MDN article):
An outer window is a browsing context; that is, the actual environment in which a Document is presented to the user. This may be a window or a tab, or it might be an iframe contained within another document. HTML5 refers to the outer window as the WindowProxy.
An inner window represents the actual content being displayed; it's the current view of what the user sees.
As the user navigates, documents are added to the backward-forward cache (often referred to as the bfcache). These are, in essence, inner windows. They get displayed in the outer window, which is contained in the "physical" browser window.
So as I want identify windows opened via menu that have a "physical" presence I should use outerWindowID.