Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. WebBrowser control: stuck with interframe security

WebBrowser control: stuck with interframe security

Scheduled Pinned Locked Moved C#
helpcsharpc++htmlcom
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GriffonRL
    wrote on last edited by
    #1

    Hello, I'm trying to parse frames from pages using the WebBrowser control and sometimes when frames or iframes are not from the same domain as the main page, I get an interframe security problem. This problem (or feature of IE) is well known and a workaround exists for C++. My problem is that I'm not comfortable with COM object and don't known how to translate the workaround into C#. Any help on translating this will be greatly welcome. Here is the KB article from MSDN: KB196340 - HOWTO: Get the WebBrowser Object Model of an HTML Frame // Get the IDispatch of the document LPDISPATCH lpDisp = NULL; lpDisp = m_webBrowser.GetDocument(); if (lpDisp) { IOleContainer* pContainer; // Get the container HRESULT hr = lpDisp->QueryInterface(IID_IOleContainer, (void**)&pContainer); lpDisp->Release(); if (FAILED(hr)) return hr; IEnumUnknown* pEnumerator; // Get an enumerator for the frames hr = pContainer->EnumObjects(OLECONTF_EMBEDDINGS, &pEnumerator); pContainer->Release(); if (FAILED(hr)) return hr; IUnknown* pUnk; ULONG uFetched; // Enumerate and refresh all the frames for (UINT i = 0; S_OK == pEnumerator->Next(1, &pUnk, &uFetched); i++) { // QI for IWebBrowser here to see if we have an embedded browser IWebBrowser2* pBrowser; hr = pUnk->QueryInterface(IID_IWebBrowser2, (void**)&pBrowser); pUnk->Release(); if (SUCCEEDED(hr)) { // Refresh the frame pBrowser->Refresh(); pBrowser->Release(); } } pEnumerator->Release(); } Thanks, R. LOPES Just programmer.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups