Newbie Totally Confused

E

eBob.com

I am getting into javascript because I want to extend the IE context menu.
I've made the registery changes such that my context menu addition results
in the execution of file:///C:\IEScriptGames\testscript.htm. If the file
contains

<SCRIPT>
alert(external.menuArguments.document.URL);
</SCRIPT>

I get the expected result.

However, if the file contains

<SCRIPT>
document.write("I love JavaScript");
</SCRIPT>

nothing happens. No error message, nothing.

However, if I enter the URL for the file above (the "I love JavaScript" one)
in the IE address window, then, after OKing a few security questions, I do
see the expected result.

I sense that this is not strictly a javascript question but rather pertains
to javascript when executed as the result of an IE context menu addition.
If document.write just doesn't work when executed as the result of an IE
context menu addtion then I wonder what else might not work and whether I
need to find another way to achieve what I am trying to do.

It's easy to find introductory javascript info on the web, and it's easy to
find how to make additions to the IE context menu on the web. But, so far,
I have not been able to find any introductory javascript material which is
specific to IE context menu additions.

I'll be grateful for any assistance anyone can provide.

Thanks, Bob
 
M

Martin Honnen

eBob.com said:
I am getting into javascript because I want to extend the IE context menu.
I've made the registery changes such that my context menu addition results
in the execution of file:///C:\IEScriptGames\testscript.htm. If the file
contains

<SCRIPT>
alert(external.menuArguments.document.URL);
</SCRIPT>

I get the expected result.

However, if the file contains

<SCRIPT>
document.write("I love JavaScript");
</SCRIPT>

nothing happens. No error message, nothing.

Well you need
external.menuArguments.document.write("...")
obviously, to write to the document in the window where the context menu
has been used. That should work, however calling document.write on an
already loaded document does an implicit document.open() meaning the
document.write overwrites the existing document. Usually you don't want
to do that from the context menu.
 
V

VK

I am getting into javascript because I want to extend the IE context menu.
I've made the registery changes such that my context menu addition results
in the execution of file:///C:\IEScriptGames\testscript.htm. If the file
contains

<SCRIPT>
alert(external.menuArguments.document.URL);
</SCRIPT>

I get the expected result.

However, if the file contains

<SCRIPT>
document.write("I love JavaScript");
</SCRIPT>

nothing happens. No error message, nothing.

However, if I enter the URL for the file above (the "I love JavaScript" one)
in the IE address window, then, after OKing a few security questions, I do
see the expected result.

I sense that this is not strictly a javascript question but rather pertains
to javascript when executed as the result of an IE context menu addition.

I would even say it is a question of specific Windows/IE extension.
microsoft.public.windows.inetexplorer.ie6.browser would be a more
appropriate place to ask (they discuss IE7 as well).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top