Link to home
Start Free TrialLog in
Avatar of Halibut
Halibut

asked on

IE MenuExt scripting problem

Hi,

We're trying to integrate IE with a document management package.

The plan is to add a reg key to HKCU\software...\Internet Explorer\MenuExt so that we could add 'Download file to Document Mangement' to the IE context menu for links.

We've added the key, and set it to point at a local html file that contains VBScript that will download the file, then ask a few questions before putting it into the documnet management system.
We've added this to MenuExt with a 'context' of 0x20 (Anchor), and if we right click on a URL in a web page, it appears and when selected runs the script. In the script. The script then grabs the URL using external.menuArguments.event.srcElement.href.

So, a URL in a page defined as:
<a href="www.someserver.com/docs/spec.doc">File Specification</a>
comes back to the script as www.someserver.com/docs/spec.doc. Everybodies happy. Everybodies dancing.

Except there's a fly in the ointment.

If the URL is based on an image, instead of text, for example:
<a href="www.someserver.com/docs/spec.doc"><img src="/Images/doc.gif"></a>
Then we don't get the option on the context menu, as it's a different context menu, the one for images. We've tried adding it in the image context, using 0x2 (Images) on the reg key. When we do this, we get the option, but when we grab external.menuArguments.event.srcElement.href in the script, we get www.someserver.com/Images/doc.gif, not www.someserver.com/docs/spec.doc (which is what we want).

Anyone got any ideas? Either for a different context for the reg key, or a different way of getting hold of the correct URL when we put it on the image context menu.

Cheers,

H.
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Halibut
Halibut

ASKER

Many thanks, Rob.

external.menuArguments.event.srcElement.parentNode.href was what I was looking for, in combination with a context of 0x2.

Cheers,

H.
Oh yeah, true.  I forgot about the Context thing, which already defines which srcElement is being thrown at it anyway.....cool, glad it worked.

Regards,

Rob.