Search code examples
javascriptc#window.external

How can I check if function exists on window.external


How can I check if function exists on window.external?

I'm calling C# code from javascript and I want to check if a method exists in the C# object.


Solution

  • I found the way, Just using the 'in' operator like this:

    if ('FunctionName' in window.external){
        window.external.FunctionName(...);
    }