1

I have read this highly useful post which unfortunately did not resolve my question: How may I use code in the HTA to scale down (shrink) the entire contents of the window, text and boxes both, in an HTA file? I'm using IE11 (or, it uses me), and I need to Ctrl-Scroll to downsize the window content every time I open it.

Now, I added meta http-equiv="x-ua-compatible" content="ie=edge" as suggested in comments, but now that breaks the placement of the file at position 1920,0 . Is there a solution which will allow resizing AND allow me to place the window where I need it?

<html><title>A Form </title> 
<meta http-equiv="x-ua-compatible" content="ie=edge" />.
<body style="filter:progid:DXImageTransform.Microsoft.Gradient(endColorstr='#C0CFE2', startColorstr='#365ebf', gradientType='0');"> 
<head>

<script language="JavaScript">window.resizeTo(320,1080);</script> 
<style type="text/css"> 
body { 
 transform: scale(0.9);
 height: 90%; 
 background-color: #EFEFDC; 
 font-family: Arial Narrow; 
 font-size: 12px; 
 color: #343421; 
 margin: 2px;  
filter: none !important; 
} 

b { 
 font-size: 16px; 
 padding: 1en; 
} 

</style>

<SCRIPT Language="VBScript">
    Sub Window_Onload
        window.moveTo 1920, 0
    End Sub
</SCRIPT>
Cœur
  • 37,241
  • 25
  • 195
  • 267
K7AAY
  • 48
  • 16
  • Please edit your post and add what did you tried as code until now ! – Hackoo Jul 09 '15 at 18:49
  • 1
    Set `zoom` for old IE modes, `transform: scale(X)` for IE>8 modes. – Teemu Jul 10 '15 at 04:05
  • @K7AAY The snippet works for me, though you might want to add a semicolon after the first property line. I posted a comment with a [link](http://stackoverflow.com/a/19570684/1169519) about document modes in HTAs, but looks like it has been removed for some reason ... – Teemu Jul 14 '15 at 13:43
  • Teemu7, your fix resized up put now it does not go to where I need it, at 1920,0 .Your fix broke "window.moveTo 1920, 0" – K7AAY Jul 15 '15 at 18:04

1 Answers1

1

I reread your question and your comments and I think I understand your requirements better. To programmatically increase the zoom level of all your controls use something similar to:

<script>
document.body.style.zoom = "200%"
</script>

Feel free to add this code anywhere, I tried it at the end of the script body and it worked for me:

<html>
<head>
<title>A Form</title>
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<style>
html {
    height: 100%;
}
body {
    -ms-zoom: 0.50;
    background-image: linear-gradient(135deg, #C0CFE2, #365ebf);
}
</style>
</head>

<body>

What is your name?<p>

<input id="name" value="Luke"></input><p>

<input type="button" value="CLICK ME" onclick="alert('Obi-Wan says: Use the Force, ' + document.getElementById('name').value + '.')"><p>

</body>
<script>
  window.moveTo(100, 300);
  window.resizeTo(500, 300);
</script>

<script>
document.body.style.zoom = "200%"
</script>

</html>

enter image description here

Stephen Quan
  • 21,481
  • 4
  • 88
  • 75
  • Does NOT solve the problem. Now, the [Reset] button fails. – K7AAY Jul 20 '15 at 22:53
  • In the Chromium and Chrome browsers. – K7AAY Apr 17 '19 at 22:43
  • I rewrote the answer, hope it is what you're looking for. – Stephen Quan Apr 18 '19 at 05:13
  • The comment about Chromium and Chrome makes no sense. HTAs run via MSHTA.exe and are rendered by MSHTML.dll. Browsers do not come into play. Testing HTA code in Chrome wouldn't make sense either. – LesFerch Aug 11 '22 at 04:01
  • Note that `content="IE=edge"` is essentially equivalent to `content="IE=11"` and does not support the `hta:application` section. Generally `content="IE=9"` is the preferred setting for HTAs. Of course, the CSS gradient used in the example above won't work in IE=9 mode. – LesFerch Aug 11 '22 at 04:04