Search code examples
javascriptfirefox-addonwindowxul

Is it possible to clone a xul window multiple times, with different contents?


I'm trying to create a "sticky-note" app where I want to manage any number of notes at any given time. Already managed to create the main program that can open another window (that will be my sticky note), but calling the function that created the first window won't call anymore windows. Is there a way to create another instance of one window multiple times with different contents?

This is the JavaScript that i'm using to create a window:

window.open("chrome://stickies/content/window.xul","window","chrome=1, titlebar=0");

Solution

  • From window.open() documentation:

    To open a new window on every call of window.open(), use the special value _blank for strWindowName.

    You are always using the same window name as target which is why only one window opens. You should use _blank as window name, this will make sure that a new window is opened instead of reusing the existing window:

    window.open("chrome://stickies/content/window.xul", "_blank", "chrome=1, titlebar=0");