At 21:24 20/01/2001 +0000, Chad Birely wrote:
Hello.  I would like to limit the number of browser windows to one.  I
haven't been able to find a way to do this through XUL, so I've started
looking through the source.  I'm guessing that there's some function
that is always called to create a new browser window.  The plan is to
have this function return the current window if another widow is
requested.  Does this seem like a reasonable course of action?  My best
guess is that I need to deal with nsGlobalWindow, but my search for a
factory or something of that sort hasn't panned out.  Can anyone make
some suggestions as to how I can go about acomplishing this?  I'm having
trouble piecing together what happens when a browser window is created.
Thanks.

Aaron

Having done this I can give you the code if you'd like.  You're right in that nsGlobalWindow is the level to do it at. OpenInternal is the function which checks whether to open a new window or not.  The method I used was to assign the same name to window regardless of the window name passed in.  In my case I used "_content". 

That's fine and it stops windows opening completely, but there are a number of side effects which is the reason I haven't contributed.

1.  Dialogs have to be renamed as a known name so that they can still be opened as a new window, I chose "_dialog".
2.  In some cases javascript that opens a new window and then is called by a core window js code will fail because the document won't have finished loading.
3.  Creating a new window legitamately, i.e. File|New Window  will create the chrome and window within the current window.  This isn't so bad and could be fixed fairly easily.

Simon


 Beware knowledge cheaply gained for in the spending of it you may pay more than its worth.
 S. P. Lucy

Reply via email to