1

I am trying to use iframes in an HTA application running on a Windows 10 machine. Both the parent and the embedded page are HTA applications. However, the iframe page/application always opens in a new window. These are the test pages I am using - I have kept them as simple as possible, but nothing seems to work.

<HTML>
<HEAD> 
<HTA:APPLICATION ID="oHTA" APPLICATIONNAME="Optic" WINDOWSTATE="maximize" />
</HEAD>
<BODY>
<IFRAME APPLICATION="yes" src="test2.hta" style="width:100%;height:100%;"></IFRAME>
</BODY>
</HTML>

and test2.hta source:

<HTML> 
<HEAD> 
<HTA:APPLICATION ID="oHTA" APPLICATIONNAME="Optic" />
</HEAD>
<BODY>
TEST2.hta
</BODY>
</HTML>
Teemu
  • 21,017
  • 6
  • 49
  • 91
Walter
  • 11
  • 1

1 Answers1

0

This is expected behavior. HTA is an application window, and the primary purpose of it is to offer a window to an application (similar to any Windows application window), in which you can run privileged JS/VBS code.

To solve your problem, change all the .hta files, intended to be shown in an iframe, to regular .htm (or .html) files, and remove HTA tag from the files.

When the iframe on the main page has application="yes" attribute, a .htm file loaded into that iframe has the same rights as the main page (the HTA). This is also good to remember, if you're planning to show some content loaded from the internet in the iframe.

The said attribute is also needed to allow the main page and the framed page to interact with each other. If the attribute is omitted, or the value is set to "no", the main page and the framed page can't interact with each other.


Notice, that HTA is a deprecated technique. You can check some tips to upgrade your HTA even a bit closer to the modern web features and JavaScript.

Teemu
  • 21,017
  • 6
  • 49
  • 91