Dmitry
Dmitry

Reputation: 423

Why hta script doesn't run from internet explorer menu item?

I created this hta file:

<script type="text/javascript">
alert("alert!!!");
</script>

And added menu item in IE (like described here: http://msdn.microsoft.com/en-us/library/aa753591(v=vs.85).aspx) to run it. I see my menu item in ie, script value in my menu item's registry key points to my hta file. So why when I press menu item nothing happens(I see no alert). Please help me to debug it.

Upvotes: 1

Views: 730

Answers (2)

Dmitry
Dmitry

Reputation: 423

I changed file extension from hta to htm and it started working. )))

Upvotes: 1

Teemu
Teemu

Reputation: 23396

Actually, at the end of the MSDN page there are some instructions by yecril. Yecril says, that the document is not available as it normally would. document should be referred via external.menuArguments, which actually seems to represent the current window object.

alert() is a method of window, so I suppose your script should be something like:

<script type="text/javascript">
    var win = external.menuArguments;
    win.alert("alert!!!");
</script>

(I know this is pure speculation and should be rather a comment, but I found this being too broad for a comment.)

Upvotes: 0

Related Questions