HTA Trusted iFrame (snippet)
: 08 lis 2024, 10:37
Required to launch an ActiveX object in an iframe (in this example, shell.Run) without confirmation. Asking for permission is the default behavior, and this code can bypass it.

APPLICATION=YES TRUSTED=YES
+
+ HTML:
+
+ a default.htm file with any content
Works under WinXP and Win11.

APPLICATION=YES TRUSTED=YES
Kod: Zaznacz cały
<a href="menu/a.htm" target="contentiframe"">A</a>
<a href="menu/b.htm" target="contentiframe"">B</a>
Kod: Zaznacz cały
<iframe name="contentiframe" id="contentiframe" src="menu/default.htm" APPLICATION=YES TRUSTED=YES>
<p>Your browser does not support iframes.</p>
</iframe>
+ HTML:
Kod: Zaznacz cały
<script>function runFile() {
try {
var shell = new ActiveXObject("WScript.Shell");
shell.Run('test.exe');
} catch (e) {
alert("Error.");
}
}
</script>
Kod: Zaznacz cały
<input type="button" value="Instaluj" onclick="runFile()" />
Works under WinXP and Win11.