What is the use of window.external?

后端 未结 2 1233
醉酒成梦
醉酒成梦 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条回答
  •  臣服心动
    2020-12-08 16:03

    It is a convention utilised by some of the browser / operating system vendors to facilitate communication between javascript running within the browser and code running "outside" of the browser on the users device or machine.

    For example, if you've written a native application for Android or Windows Phone that hosts a web browser control, the surrounding native mobile framework might provide window.external as a way for javascript running on the web page within the web control to call out to your app's native code functionality. (An example of how to such things for Android can be found here: Listen to javascript function invocation from java - Android )

    If, on the other hand, you're looking to communicate between the javascript running on the user's web browser and the C# code running on your server then you'll be wanting to investigate AJAX style calls (which usually has very little to do with window.external). Examples of set up such things can be found at the ASP.Net site. e.g. http://www.asp.net/web-forms/tutorials/aspnet-ajax/understanding-asp-net-ajax-web-services

提交回复
热议问题