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. Javascript variable from WebBrowser control

Javascript variable from WebBrowser control

Scheduled Pinned Locked Moved C#
helpjavascripthtmlquestion
2 Posts 2 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.
  • A Offline
    A Offline
    arro2001
    wrote on last edited by
    #1

    Hi folks I'm trying to get the javascript variable in the HTML page loaded in WebBrowser control through IHTMLDocument2 interface. In VB6 it was simple: "WebBrowserInstance.Document.parentWindow.variableName". But, I stuck in MSHTML interfaces. Could somebody help me with that? Thanks

    T 1 Reply Last reply
    0
    • A arro2001

      Hi folks I'm trying to get the javascript variable in the HTML page loaded in WebBrowser control through IHTMLDocument2 interface. In VB6 it was simple: "WebBrowserInstance.Document.parentWindow.variableName". But, I stuck in MSHTML interfaces. Could somebody help me with that? Thanks

      T Offline
      T Offline
      tarasn
      wrote on last edited by
      #2

      You may get variable in this way : IHTMLDocument2 document2 = (IHTMLDocument2)axWebBrowser1.Document; object variable= document2.parentWindow.GetType().InvokeMember ("variableName", BindingFlags.GetProperty, null, document2.parentWindow, new Object [] {}); The snippet below shows how to set the variable document2.parentWindow.GetType().InvokeMember ("variableName", BindingFlags.SetProperty, null, document2.parentWindow, new Object [] {"New value"}); DevIntelligence.com - My blog for .Net Developers

      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