Is there a way to determine if the ObjectForScripting property of the WPF WebBrowser control has been set via javascript running in said control? Or, is there a way to determine if the ObjectForScripting has a given method or property defined via javascript?
If ObjectForScripting is not set, window.external
will be null
.
if(window.external === null)
alert('ObjectForScripting is not set');
else
alert('ObjectForScripting is set');
To check if ObjectForScripting
has a specific method/property, just check if it's undefined or not.
if(window.external !== null && typeof window.external.MethodName !== 'undefined')
{
// Method exists
window.external.MethodName();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.