From MozillaZine Knowledge Base
Jump to navigationJump to search
|
|
(4 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| {{extdev}}
| | Moved to [http://developer.mozilla.org/en/docs/Code_snippets:Windows MDC]. |
|
| |
|
| To open a new browser window, you can simply use <code>window.open</code>. However, <code>window.open</code> returns a <code>Window</code> object for content, not for the browser window itself, so you should get the chrome <code>Window</code> first. The simplest way to do that is to use [[nsIWindowMediator]].
| | [[Category:Redirects]] |
| | |
| == Example ==
| |
| window.open();
| |
| var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
| |
| .getService(Components.interfaces.nsIWindowMediator);
| |
| var newWindow = wm.getMostRecentWindow("navigator:browser");
| |
| var b = newWindow.getBrowser();
| |
| | |
| == Other resources ==
| |
| * More [[:Category:Example code|example code]].
| |
| * Working with [[nsIWindowMediator]].
| |
| * More about [http://developer.mozilla.org/en/docs/Working_with_windows_in_chrome_code working with windows].
| |
| | |
| [[Category:Example code|Opening a new browser window]] | |
Latest revision as of 21:44, 6 February 2007