1<a onclick="window.open(document.URL, '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');">
2Open New Window
3</a>
1var newWin = open('url','windowName','height=300,width=300');
2newWin.document.write('html to write...');
3
1<script type="text/javascript">
2var windowObjectReference = null; // global variable
3
4function openRequestedPopup(url, windowName) {
5 if(windowObjectReference == null || windowObjectReference.closed) {
6 windowObjectReference = window.open(url, windowName,
7 "resizable,scrollbars,status");
8 } else {
9 windowObjectReference.focus();
10 };
11}
12</script>
13
14(...)
15
16<p><a
17 href="http://www.spreadfirefox.com/"
18 target="PromoteFirefoxWindow"
19 onclick="openRequestedPopup(this.href, this.target); return false;"
20 title="This link will create a new window or will re-use an already opened one"
21>Promote Firefox adoption</a></p>
22
1<script type="text/javascript">
2var windowObjectReference = null; // global variable
3
4function openFFPromotionPopup() {
5 if(windowObjectReference == null || windowObjectReference.closed)
6 /* if the pointer to the window object in memory does not exist
7 or if such pointer exists but the window was closed */
8
9 {
10 windowObjectReference = window.open("http://www.spreadfirefox.com/",
11 "PromoteFirefoxWindowName", "resizable,scrollbars,status");
12 /* then create it. The new window will be created and
13 will be brought on top of any other window. */
14 }
15 else
16 {
17 windowObjectReference.focus();
18 /* else the window reference must exist and the window
19 is not closed; therefore, we can bring it back on top of any other
20 window with the focus() method. There would be no need to re-create
21 the window or to reload the referenced resource. */
22 };
23}
24</script>
25
26(...)
27
28<p><a
29 href="http://www.spreadfirefox.com/"
30 target="PromoteFirefoxWindowName"
31 onclick="openFFPromotionPopup(); return false;"
32 title="This link will create a new window or will re-use an already opened one"
33>Promote Firefox adoption</a></p>
34
1<script type="text/javascript">
2var windowObjectReference = null; // global variable
3var PreviousUrl; /* global variable that will store the
4 url currently in the secondary window */
5
6function openRequestedSinglePopup(url) {
7 if(windowObjectReference == null || windowObjectReference.closed) {
8 windowObjectReference = window.open(url, "SingleSecondaryWindowName",
9 "resizable,scrollbars,status");
10 } else if(PreviousUrl != url) {
11 windowObjectReference = window.open(url, "SingleSecondaryWindowName",
12 "resizable=yes,scrollbars=yes,status=yes");
13 /* if the resource to load is different,
14 then we load it in the already opened secondary window and then
15 we bring such window back on top/in front of its parent window. */
16 windowObjectReference.focus();
17 } else {
18 windowObjectReference.focus();
19 };
20
21 PreviousUrl = url;
22 /* explanation: we store the current url in order to compare url
23 in the event of another call of this function. */
24}
25</script>
26
27(...)
28
29<p><a
30 href="http://www.spreadfirefox.com/"
31 target="SingleSecondaryWindowName"
32 onclick="openRequestedSinglePopup(this.href); return false;"
33 title="This link will create a new window or will re-use an already opened one"
34>Promote Firefox adoption</a></p>
35
36<p><a
37 href="https://www.mozilla.org/support/firefox/faq"
38 target="SingleSecondaryWindowName"
39 onclick="openRequestedSinglePopup(this.href); return false;"
40 title="This link will create a new window or will re-use an already opened one"
41>Firefox FAQ</a></p>
42