Active tab ignored by InternetExplorer COM object for IE 8

后端 未结 2 822
温柔的废话
温柔的废话 2021-01-13 06:12

This is web single sign on code that runs on a .net 3.5 winform. The code runs fine for ie6 or ie8 as long as ie8 only has one tab open. The problem is that if the user ope

相关标签:
2条回答
  • 2021-01-13 06:19

    It turns out that each tab in IE 8 has it's own process and handle. In the original code i was always getting the handle from the first IEFrame. I modified the code (below) and now it works. The change is that instead of looking for just the first IEFrame handle, the code also looks for a LocationURL that matches the url that triggerd the method that calls WebFormsSignOut.

    private void WebFormSignOn(int iEFramHandle,string addressBarText)
    {
        var shellWindows = new SHDocVw.ShellWindows();
        foreach (SHDocVw.InternetExplorer ie2 in shellWindows)
        {
            if (ie2.LocationURL==addressBarText)
            { //rest of the code (see orignal post)
    
    0 讨论(0)
  • 2021-01-13 06:42

    Internet Explorer does not have any public tab APIs (beyond allowing you to target a navigation to a new foreground or background tab). Each ActiveX control or BHO is loaded individually into an individual tab instance. Trying to walk down from the ShellWindows collection isn't likely to work in general, instead you should have your plugin reach out to its hosting site (e.g. IObjectWithSite::SetSite will convey this info) which will allow you to determine your hosting tab.

    0 讨论(0)
提交回复
热议问题