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. C# WebBrowser using JavaScript

C# WebBrowser using JavaScript

Scheduled Pinned Locked Moved C#
csharpjavascriptai-models
3 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.
  • R Offline
    R Offline
    Reanalyse
    wrote on last edited by
    #1

    I have a WebBrowser component on a form, and it interacts with a site (www.zoomin.co.nz)though Javascript. The Javascript contains functions such as GPoint gpt= GMap.getCenterLatLong() In my application I need to be able to call that function in Javascript and find out the values for gpt (of the two floating point values that make it up) in my C# code. Thanks

    E 1 Reply Last reply
    0
    • R Reanalyse

      I have a WebBrowser component on a form, and it interacts with a site (www.zoomin.co.nz)though Javascript. The Javascript contains functions such as GPoint gpt= GMap.getCenterLatLong() In my application I need to be able to call that function in Javascript and find out the values for gpt (of the two floating point values that make it up) in my C# code. Thanks

      E Offline
      E Offline
      Ed Poore
      wrote on last edited by
      #2

      If you look inside the Document property there is a method called Invoke or InvokeScript (something like that anyway), you can pass the function name and parameters of the JavaScript function to invoke through this.  As for getting the results it's probably documented in the documentation about the InvokeScript function. (This may not be completely accurate but I do know that such a method does exists since I've used it but for reasons given in my sig I won't guarantee the accuracy :-D)


      As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google it

      R 1 Reply Last reply
      0
      • E Ed Poore

        If you look inside the Document property there is a method called Invoke or InvokeScript (something like that anyway), you can pass the function name and parameters of the JavaScript function to invoke through this.  As for getting the results it's probably documented in the documentation about the InvokeScript function. (This may not be completely accurate but I do know that such a method does exists since I've used it but for reasons given in my sig I won't guarantee the accuracy :-D)


        As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google it

        R Offline
        R Offline
        Reanalyse
        wrote on last edited by
        #3

        Thanks - I will look at invoke script I was not too lazy to google it, but found nothing straightforward fron the search :laugh:

        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