Failed to call a BHO method from Javascript in IE9
Asked Answered
P

2

6

I am trying to call a BHO object method from a javascript function (the javascript is injected by the BHO using IHTMLWindow2 execScript).

function foo()
{
   IEBHO.DoSomething();
}

The IEBHO is a BHO object and loaded in IE9 already.

And the "DoSomething" interface/method is declared in IDL file of BHO project as:

[id(1), helpstring("method DoSomething")] HRESULT DoSomething();

This approach works fine with IE7 and IE8 perfectly. The method/interface "DoSomething" gets called from the javascript function successfully.

However in IE9, it seems to fail always. The javascript seems to fail to find the IEBHO object in its namespace, which results failure of calling the "DoSomething" method.

I even used the IE7/IE8 Document Mode inside IE9 and they all works fine, but as soon as it is set to the default IE9 document mode, it fails.

Is this a BUG in IE9? or there is a new way do accessing the BHO method?

Please help...

Best regards,

Frank

Pyrethrum answered 23/3, 2011 at 8:12 Comment(2)
In IE9 JavaScript isn't running in the WSH anymore but directly in the browser (very similar to the way other browsers do it) to avoid the issues with the DOM existing twice: both in the browser and in the WSH. Probably this is the reason for your issues.Acidulate
If it is not in Windows Script Host (I assume it is what you mean here about WSH), how do I access the BHO object inside the browser via the javascript? Thanks, Much Appreciated, FrankPyrethrum
G
1

For firsy time, check that BHO is enabled in you IE9

Extensibility

In Internet Explorer 9, the extensibility mechanisms for Browser Helper Objects (BHOs) and toolbars remain the same. Not loading BHOs or toolbars improves startup time, but limits the ability of developers to augment the user experience through these extensibility mechanisms.

via http://en.wikipedia.org/wiki/Internet_Explorer_9

Gibberish answered 6/3, 2012 at 8:57 Comment(0)
W
0

You can create an extension by simply creating keys in registry, with a javascript file.

In this javascript file, you may call your BHO function DoSomething(). When you click the button at command bar, the BHO function will be called.

Wilkison answered 9/6, 2012 at 14:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.