What is the use of window.external?

后端 未结 2 1221
醉酒成梦
醉酒成梦 2020-12-08 15:57

What is the use of window.external? Is this used to call the server side functions / methods in C# / VB.NET (ASP.NET) from JavaScript? Can you please point me in right direc

2条回答
  •  萌比男神i
    2020-12-08 16:24

    This is largely taken from this MSDN article but window.external can be used to allow your WebBrowserControl to execute public methods of your client Windows Forms application.

    For example in your form you may have a function such as:

    public void HelloFromTheForm()
    {
        MessageBox.Show("Hi client, thanks for calling me!");
    }
    

    And in the html loaded into your WebBrowserControl you may have a button that looks like:

    
    

    So in regards to your question of 'Is this used to call the server side functions?', your form isn't 'server side' but it does allow you to call the C#/VB.NET code of your form from an embedded webpage.

提交回复
热议问题