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 / C++ / MFC
  4. window.chrome.webview.postmessage from child html to main c++ app (webView2)

window.chrome.webview.postmessage from child html to main c++ app (webView2)

Scheduled Pinned Locked Moved C / C++ / MFC
c++htmlhelpquestion
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.
  • M Offline
    M Offline
    Member_15439917
    wrote on last edited by
    #1

    I am using WebView2 for displaying html contents in my win32 application. I have parent.html in which I am providing reference of child.html like -

    In child.html :

    clickhere
    function postmessagetocode() {
    window.chrome.webview.postmessage('clickSample');
    }

    In my c++ code I am loading parent.htm and want to get above message 'clickSample' in

    m_webView->add_WebMessageReceived

    . Issue that I am facing : by doing like above I am not getting this message in code. If I post any message from parent.html then I can get it. But if I do like from child.html then it never come to c++ code. Is there the way to do so? Is it something like I need to catch the message at parent.html first then post again to c++? Thanks.

    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