0

Google searching says window.outerWidth and window.outerHeight will return the outer dimensions of the current window. However, my HTA file opening in IE11 gives "undefined" for these properties. What am I doing wrong?

<!DOCTYPE html>
<HTML>
<HEAD>
<TITLE>Size Test</TITLE>
<SCRIPT type="text/javascript">
    function ShowSize() {
        window.alert("W = " + window.outerWidth+ ", H = " + window.outerHeight);
    }
</SCRIPT>
<HTA:APPLICATION ID="oHTA"
    applicationName="Size Test"
    border="dialog" 
    borderStyle="normal" 
    caption="yes" 
    innerBorder="no"
    maximizeButton="no" 
    minimizeButton="no" 
    navigable="no"
    scroll="no"
    selection="yes"
    showInTaskbar="yes" 
    singleInstance="yes"
    sysMenu="no"
    windowState="normal"
/>
</HEAD>
<BODY>
    <button onclick="ShowSize()">test</button>
</BODY>
</HTML>

The alert dialog shows "W = undefined, H = undefined" (dammit).

  • Sweet! Thank you so much for a quick response! – starbase101 Mar 17 '17 at 21:20
  • Dang, after adding the meta information, vbscript isn't getting read. – starbase101 Mar 17 '17 at 21:26
  • that's not good! where did you add the meta tag? – Brian Mar 17 '17 at 21:28
  • If I put meta before the HTA definition then the javascript window properties work but the window is not formatted correctly and vbscript functions are undefined. If I put the meta after the HTA definition then the window is formatted correctly and vbscript functions are defined, but then the javascript window properties return undefined. (The 4 minute timeout here for edits sucks.) – starbase101 Mar 17 '17 at 21:32
  • I am new to posting at Stack Exchange so I don't know how to post code after the initial post. – starbase101 Mar 17 '17 at 21:34
  • Size Test – Brian Mar 17 '17 at 21:36
  • That's where I put it (before the HTA definition), and then the javascript window properties work, but the HTA window isn't configured properly and vbscript added to HEAD doesn't get read. So then I moved it to after the HTA definition (but still inside HEAD) and the window is configured properly and vbscript functions are available, but then the javascript window properties are undefined. – starbase101 Mar 17 '17 at 21:43
  • If I move META to between the two SCRIPT tags ... then the window is formatted correctly, both vbscript and javascript are defined, but now the window properties are undefined again. Grrrrrr (Micros**t....) – starbase101 Mar 17 '17 at 21:50
  • It's just, that HTA is deprecated. The last version with full support was IE9. IE10+ don't support HTA, use "IE=9" as the content of `X-UA`, that will allow you to utilize HTA windows and the most of the features of the newer IEs. – Teemu Mar 20 '17 at 06:08

0 Answers0