Strona 1 z 1

HTA Trusted iFrame (snippet)

: 08 lis 2024, 10:37
autor: WinSxS
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.

Obrazek

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()" />
+ a default.htm file with any content

Works under WinXP and Win11.