0
我不希望用戶在找不到自定義插件時在其Firefox上看到「安裝缺少的插件」。我如何禁用此功能?在Firefox中,如果我的自定義插件找不到,我該如何禁用「安裝缺少的插件」?
<object height="0" width="0" id="mycustomPlugin" type="application/x-vnd-puppyt"></object>
我不希望用戶在找不到自定義插件時在其Firefox上看到「安裝缺少的插件」。我如何禁用此功能?在Firefox中,如果我的自定義插件找不到,我該如何禁用「安裝缺少的插件」?
<object height="0" width="0" id="mycustomPlugin" type="application/x-vnd-puppyt"></object>
一種方式做到這一點 - 有可能是其他人 - 是檢查,看看創建對象標記之前無論是在navigator.plugins數組中的上市。像這樣的東西(一些示例代碼從最近的項目中剪切並粘貼):
function createVncServer(id) {
console.log(navigator.userAgent);
var vncDiv = document.getElementById("vncDiv");
if (navigator.userAgent.indexOf("MSIE") > -1) {
vncDiv.innerHTML = "<object id='" + id + "' classid='CLSID:42832F4C-3480-4450-A6B5-156B2EFC408F' codebase='http://localhost:51150/Resources/WinVncCtlInstaller.CAB' />";
}
else {
// On Mozilla browsers, check to make sure the plugin is installed before we try to instantiate it, to avoid the weird "plugins required" message.
var pluginInstalled = false;
for (var i = 0; i < navigator.plugins.length; i++) {
console.log(navigator.plugins[i].name);
if (navigator.plugins[i].name == 'Alanta Remote Desktop Server') {
pluginInstalled = true;
}
}
if (pluginInstalled) {
vncDiv.innerHTML = "<object id='" + id + "' type='application/x-alanta-vnc' />";
}
else {
promptForDownload();
return null;
}
}
var vncServer = document.getElementById(id);
try {
if (vncServer.Port > 0) {
clearDownloadPrompt();
return vncServer;
}
else {
promptForDownload();
}
}
catch (ex) {
promptForDownload();
}
}