IScriptEngine5 能够使外部网页和skyline弹出的窗口之间进行通信,通过将网页注册成全局,定义通用函数,使其他的网页能够进行访问,代码如下:
//全局网页的注册
function tyhs()
{
try { IScriptEngine5.UnregisterName("topWindowYALB"); } catch (e) { a = 0;};
try{IScriptEngine5.RegisterGlobalName("topWindowYALB",window);}catch(e){};
}
//在全局网页定义函数
function commfun()
{
document.getElementById("test").innerText="adsfaf";
}
//网页通过名称获得操作函数,并操作全局网页上的函数
function ScriptEngine()
{
var conmfun=IScriptEngine5.GetGlobalName("++topWindowYALB");
conmfun.commfun();
}
function tyhs()
{
try { IScriptEngine5.UnregisterName("topWindowYALB"); } catch (e) { a = 0;};
try{IScriptEngine5.RegisterGlobalName("topWindowYALB",window);}catch(e){};
}
//在全局网页定义函数
function commfun()
{
document.getElementById("test").innerText="adsfaf";
}
//网页通过名称获得操作函数,并操作全局网页上的函数
function ScriptEngine()
{
var conmfun=IScriptEngine5.GetGlobalName("++topWindowYALB");
conmfun.commfun();
}
转载于:https://blog.51cto.com/speciallist/1106466