0
点赞
收藏
分享

微信扫一扫

TE对NPAPI的支持

中间件小哥 2022-09-27 阅读 17

NPAPI,就是指网景插件应用程序接口(Netscape Plugin Application Programming Interface),是一种外部程序作为插件和浏览器共同完成网页展示的调用通道。插件就相当于运行在网页上的应用程序。比如你想在网页上播放音乐,在网页上使用<embed>标签,浏览器会自动调用Windows Media Player运行,又如pdf等。还有,也可以用作在浏览器检测和启动客户端应用程序。

TE从6.6版本后开始支持NPAPI,但是chrome v42以上版本,默认关闭NPAPI插件,Firefox 52停止支持所有 NPAPI插件,所以NPAPI的TE二次开发后来基本也没用上。

官方提供了一个简单的基于NPAPI的网页开发,在chrome和firefox的低版本还能支持,有兴趣可以试一下,以下是详细代码:

<html>
<head>
<title>样例</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script type="text/javascript">
function LoadFly() {
try {
var sg = CreateSGObj();
sg.open("fly地址");
}
catch (e) {
alert(e);
}
}
//创建sgworld的object
function CreateSGObj() {
var obj = document.getElementById("sgworld");
if (obj == null) {
obj = document.createElement('object');
obj.setAttribute("name", "sgworld");
obj.setAttribute("id", "sgworld");
obj.setAttribute("type", "application/x-skyline");
obj.setAttribute("clsid", "{3A4F9199-65a8-11d5-85c1-0001023952c1}");
document.body.appendChild(obj);
}
return obj;
}
</script>
</head>
<body>
//窗口的定义和在IE上有些不同
<object id="tex" type="application/x-skyline" clsid="{3A4F9192-65A8-11D5-85C1-0001023952C1}" style="width: 1000px; height: 580px;"></object>
//窗口的定义和在IE上有些不同
<object id="texTree" type="application/x-skyline" clsid="{3a4f9193-65a8-11d5-85c1-0001023952c1}" style="width: 300px; height: 580px;"></object>
</body>
</html>

举报

相关推荐

0 条评论