WebGL communication: how to access a C# variable by means of js

In my app, I have a script: ‘myScript.cs’ that contains a variable ‘myVar’.
When compiling for WebGL, Unity will create a web environment with an ‘index.html’ page and other stuff.

My question: To this generated web environment, I want to add javascript that reads the value of ‘myVar’.
Anyone who can tell me how to send out the value of ‘myVar’ at the C# side, and how to pick up this value at the js side?

Thanks a lot,

I am one step further now. According to the manual, I have created this code at the C# side:

  private void OnTimedEvent()
    {
        Application.ExternalCall("getMyVar", "hello world");      
      
    }

I call this code one time per second.

At the HTML side I have added the following js code:

function getMyVar( myVar )
{
    alert( myVar );
}

The FireFox browser comes back with the error: ‘getMyVar is not defined’.
Anyone knows what I have done wrong here?
Thanks,

try

var msg = Pointer_stringify(myVar);
alert(msg);

pearhaps this example can help you too:

This makes a difference, because the error message has disappeared. However, now the page freezes and there is another error: “a webpage is slowing down your browser”. It looks like there is some communication now, but it gets caught up…

call this only once, not every second. parhaps you get a alert message every second now.