Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is Firefox 6 ignoring my height, width, top and left settings in javascript window.open?
    primarykey
    data
    text
    <p>Can anybody see what's wrong with my code? It behaves properly in IE but firefox 6 seems to ignore any height or width settings that I pass through to the javascript window.open call. I can't see anything obviously wrong with it but javascript isn't my first language so I may be making a noob error somewhere in this.</p> <p>The purpose of this function is to open an 800x600 window centered on the screen and displayed modally in both IE and Mozilla family browsers.</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script language="javascript" type="text/javascript"&gt; function openWindow(pageURL,Title,w,h) { var left = (screen.width/2)-(w/2); var top = (screen.height/2)-(h/2); if (window.showModalDialog) { window.showModalDialog(pageURL,Title,'dialogWidth:' + w + 'px,dialogHeight:'+ h + 'px,dialogTop:'+ top + 'px,dialogLeft:' + left + ',resizable=no'); } else { window.open(pageURL,Title,"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes,resizable=no,modal=yes, copyhistory=no,width=" + w + ", height=" + h + ", top=" + top + ", left=" + left) } } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;a href="javascript:openWindow('http://www.google.com','Google',800,600);"&gt;Launch&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Just to clarify a bit, the function is designed to test for the presence of ShowModalDialog (presuming that only IE supported it) and fall into the proper window.open branch in everything that supports the W3C window.open command which implements the "Modal" option. The idea being that if ShowModalDialog was implemented then it would use that otherwise use the window.open with the "Modal" option.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload