开发者

SpicIE - How to get the real address in the address bar?

I'm trying to write a small addon for Internet Explorer using SpicIE. I understood how to respond to events using code like:

this.OnDocumentComplete += new SpicIE.Common.WebBrowserEvent_DocumentComplete(SamplePlugin_OnDocumentComplete);
this.OnNavigateComplete += new SpicIE.Common.WebBrowserEvent_NavigateComple开发者_开发百科te2(SamplePlugin_OnNavigateComplete);
this.OnBeforeNavigate += new SpicIE.Common.WebBrowserEvent_BeforeNavigate2(SamplePlugin_OnBeforeNavigate);

When the eventhandlers are called, I can see the current URL of the event. The eventhandlers, however, are called for every webbrowser object event, including iframes. I need to respond only when the url that is in the address bar is changed (where you type the url that you want to navigate to).

How do I find out if the event belongs to the top frame\webbrowser? Is there a way to grab the address-bar url using the pDisp object or something else?


After adding a reference to Interop.SHDocVw I can look at:

HostInstance.BrowserRef.LocationURL

The eventhandlers are called to many times (because of the iframes) but I can check every time if the new address is different from the old one.

HostInstance is set in the plugin constructor like most examples - don't forget to verify that HostInstance is not null.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜