dynamic test our NPAPI plugins

本文提供了一个完整的例子,用于验证自定义生成的plugin插件的加载与基本操作。


这篇文章给出一个完整的例子, 用于测试自己生成的plugin 插件。




<html>

<head>

<script type="text/javascript">

function testDynamicPlugin() {
  var elem = document.createElement("embed");
  elem.id = "example-plugin";
  elem.type = "application/x-kreatell-toi";
  //elem.type = "application/x-kreatell-example-plugin";
  elem.setAttribute("hidden", "false");
  elem.width = 400;
  elem.height = 400;
  document.body.appendChild(elem);
 
  // this wrokaround can work for toi on webkit537,
  // but now this workaround cannot work for webkit600.
  document.body.offsetWidth;


        var example-plugin = document.getElementById("example-plugin");
        alert("====teletext Object===" + example-plugin);
 
        // Check whether this code line will throw erro or not in log.
        example-plugin.active = false;
        alert("====Success to set example-plugin acitce property==");
 
 
   
        var gPluginVersion = document.getElementById("example-plugin").version;
 
 
        //console.log("==========toi.mediaService.REASON_COMMAND_OPEN=" + toi.mediaService.REASON_COMMAND_OPEN);
        console.log("==========gPluginVersion=" + gPluginVersion);
 
        // Check whether this code line will throw erro or not in log.
        //example-plugin.tick();
        //alert("====Success to call example-plugin tick()==");


  try {
    var networkConf = toi.netService.getConfiguration();
    //plugin.flofGreenKey()
    alert("test dynamic plugins");
  }
  catch (e) {
    alert("Exception :" + e);  
  }
}
</script>

</head>


<body onload="testDynamicPlugin();" style="background-color: white">

<p>Test toi plugin is dynamically loaded or not.</p>

</body>
</html>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值