BHO Cross Domain Cookie Handle C# RRS feed

  • Question

  • Hi,
    We are developing BHO IE extension.
    Functionality need to be implemented :
    BHO will show div/box contain "Login" Button on any loaded page(ex. youtube.com). 
    On click of "Login" it will open a specific url in new tab.User will login on new opened specified url
    that will set cookie for newly opened specified url.Cookie will be read by bho and bho will display "Pin"
    button instead of "Login" button.On click on "Pin" Button api call will be handled.

    Used approach :
    Using "DWebBrowserEvents2_DocumentCompleteEventHandler" handler and document of "IWebBrowser2" we have read cookie of specified url
    and we saved it in localStorage using javaScript.Beacause localStorage is domain specific,we are unable to read cookie
    value on first url (or tab) where we executed BHO.Please help us to handle this problem.

    Tried solutions :
    1. Used windowstatechanged event in setsite method to handle browser tab change 
    but this event is not firing on IE.

    2. Used OnVisible event in setsite method to handle browser tab change 
    but this event is not firing on IE.

    Is there any solution to implement above mentioned functionality?(Need to save cookie at browser level and access it and update it on expire)
    Please let me know how to handle the same.


    Tuesday, March 12, 2019 7:02 AM

All replies

  • Enhanced Protected Mode is turned on for internet security zone web sites by default. That means web sites will be ran in separate processes and they are isolated from each other by running at the AppContainer integrity level. Cache, cookies, and other web-platform state information are not shared between different AppContainers. Thus by default you can't save state information in the browser itself if you want to share between tabs running different web sites. 

    To support EPM

    1 your BHO needs to install both 32 bit and 64 bit versions on customer's computer

    2 your BHO needs to register under the CATID_AppContainerCompatible category

    3 your BHO needs to register a broker process that runs at Medium integrity level to facilitate communication between your BHO instances in different tabs. For inter-process communication objects (e.g. shared memory or named pipes) you need to grant access accordingly.

    Visual C++ MVP

    Tuesday, March 12, 2019 2:05 PM
  • Hi,

    Thanks for reply :)

    Is there any way to find browser tab change event and handler for same in BHO C#?

    Note: I am developing BHO IE extension in C#. Need to execute C# code on browser tab change event.


    Thursday, March 14, 2019 5:57 AM
  • My experience with writing BHO in C# is slow CLR initialize time cause IE to prompt to disable your BHO.

    The DWebBrowserEvents2::WindowStateChanged is raised when 

    • The browser window is minimized or restored.
    • An active tab becomes inactive.
    • An inactive tab becomes active.
    • The browser window is enabled or disabled due to a modal dialog box.


    Visual C++ MVP

    Thursday, March 14, 2019 10:05 PM