title: VB.NET Gecko Web Browser javascript function calling?
body: <p>I am using <code>GeckoWebBrowser</code> within my <code>VB.NET</code> (Windows Form App) program. The <code>GeckoWebBrowser</code> loads a local <code>html</code> file. This <code>html</code> has embed in-line a <code>svg</code> file (<a href="http://i.stack.imgur.com/z19NK.png" rel="nofollow">human body diagram with bones and internal organs</a>) with a <code>javascript</code> function for picking up all the "ids" of the elements from the <code>svg</code> document. I'd like to call the aforementioned <code>javascript</code> function from <code>VB.NET</code> (Windows form app), but I don't know how to do so. Can anyone help me, or give me a source code example please? All the stuff I've found is based in <code>C#</code>...
  This is my <code>javascript</code> function in my <code>html</code> file:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  (funcion () {
  
  // Function to be called in VB.NET when the DOM is loaded
  
  
  var SVGHandler = function () {
  
      // Picking up the id Root Node="CUERPO_HUMANO" into svg variable
  
      var svg = document.querySelector('#CUERPO_HUMANO');
  
  
      // In Items we save all the &lt;g&gt; which have an ID
  
      var items = svg.querySelectorAll('g[id], path[id]');
  
      //var items = svg.querySelectorAll('g[id]');
  
      // We loop all the nodes saved in Items and add them to click event listener 
  
      forEach(items, function (index, value) {
  
          value.addEventListener('click', function (event) {
  
  
  
                  event.preventDefault();
  
                  //We avoid the spread of events
                  event.stopPropagation();
  
  
  
  
  
                  return event.currentTarget.id
  
                  // console.log(event.currentTarget.id)
  
              });
  
      });
  
  
  
  }
  
  // https://toddmotto.com/ditch-the-array-foreach-call-nodelist-hack/
  
  var forEach = function (array, callback, scope) {
  
    for (var i = 0; i &lt; array.length; i++) {
  
      callback.call(scope, i, array[i]); // passes back stuff we need
  
    }
  
  };
  
  
  
  // With this method, we call a SVGHandler when DOM is totally loaded 
  
  document.addEventListener('DOMContentLoaded', SVGHandler);
  
  })();
  
  &lt;/script&gt; 
  </code></pre>
  
  <p>What code should I use in <code>VB.NET</code> for calling my <code>javascript</code> function each time I click on a specific bone or organ in the human body diagram loaded in <code>GeckoWebBrowser</code>?
  I want to save the "id" picked up with the calling into a <code>string</code> variable in order to use it as a parameter in a <code>SQL</code> statement and populate a <code>DataGridView</code>.
  I've been searching and all that I could find was related to <code>C#</code>, not a single <code>VB.NET</code> example. Even though I was trying to figure out the equivalence in <code>VB.NET</code> trying to convert the <code>C#</code>'s examples to <code>VB.NET</code>, I have some doubts on how to do the <code>javascript</code> call. According to my <code>javascript</code> function It could be something like this:</p>
  
  <pre><code>browserControl.Navigate("javascript:void(funcion())");
  </code></pre>
  
  <p>Please, Can anyone help me to solve this? I would be very thankful...</p>