如何检查window.external上是否存在函数 [英] How can I check if function exists on window.external
本文介绍了如何检查window.external上是否存在函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何检查window.external上是否存在功能?
How can I check if function exists on window.external?
我正在从javascript调用C#代码,我想检查C#对象中是否存在方法.
I'm calling C# code from javascript and I want to check if a method exists in the C# object.
推荐答案
我找到了方法, 像这样使用'in'运算符:
I found the way, Just using the 'in' operator like this:
if ('FunctionName' in window.external){
window.external.FunctionName(...);
}
这篇关于如何检查window.external上是否存在函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文