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. Array from JavaScript

Array from JavaScript

Scheduled Pinned Locked Moved C#
javascriptdata-structuresquestion
6 Posts 3 Posters 1 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.
  • H Offline
    H Offline
    Hans Ruck
    wrote on last edited by
    #1

    Hi all, Any idea about how could I return an array from the JavaScript code of a WebBrowser control? In another words: returning an array from a call of Document.InvokeScript. Thank you.

    Bogdan.

    L 1 Reply Last reply
    0
    • H Hans Ruck

      Hi all, Any idea about how could I return an array from the JavaScript code of a WebBrowser control? In another words: returning an array from a call of Document.InvokeScript. Thank you.

      Bogdan.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Use JavaScript's return statement.

      H 1 Reply Last reply
      0
      • L Lost User

        Use JavaScript's return statement.

        H Offline
        H Offline
        Hans Ruck
        wrote on last edited by
        #3

        :-D Well, it seems that it didn't cross my mind... Anyway, assuming that I do that, how should I interpret the answer on the .NET side? Chances are to get some COM wrappers of an interface I don't know. That's what I'm looking for, the appropriate interface to communicate through.

        Bogdan.

        L D 2 Replies Last reply
        0
        • H Hans Ruck

          :-D Well, it seems that it didn't cross my mind... Anyway, assuming that I do that, how should I interpret the answer on the .NET side? Chances are to get some COM wrappers of an interface I don't know. That's what I'm looking for, the appropriate interface to communicate through.

          Bogdan.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          The return type for Document.InvokeScript is object. May be you should step through the code in the debugger and inspect what the return value contains.

          D 1 Reply Last reply
          0
          • H Hans Ruck

            :-D Well, it seems that it didn't cross my mind... Anyway, assuming that I do that, how should I interpret the answer on the .NET side? Chances are to get some COM wrappers of an interface I don't know. That's what I'm looking for, the appropriate interface to communicate through.

            Bogdan.

            D Offline
            D Offline
            dojohansen
            wrote on last edited by
            #5

            Almost certainly IDispatch.

            1 Reply Last reply
            0
            • L Lost User

              The return type for Document.InvokeScript is object. May be you should step through the code in the debugger and inspect what the return value contains.

              D Offline
              D Offline
              dojohansen
              wrote on last edited by
              #6

              I tried that actually. In a script block in the head of the HTML doc:

              function f() { return [1,2]; }

              In the C# code:

              var list = browser.Document.InvokeScript("f");
              ToString(); // Breakpoint dummy :)

              Alas, list was null!

              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