我在使用 Microsoft Office 2010 插件在 FireFox 中打开 Microsoft Office 文档时遇到问题。
请参阅http://msdn.microsoft.com/en-us/library/ff407576.aspx
我正在 firefox 中尝试使用以下 html 文档。我已确认已安装 MS Office 2010 插件。
<doctype html>
<html>
<head>
<script>
function OpenWebDavDocument(url, extension) {
debugger;
var hownowPlugin = document.getElementById("winFirefoxPlugin");
hownowPlugin.EditDocument2(url, null)
}
</script>
</head>
<body>
<object id="winFirefoxPlugin" type=”application/x-sharepoint">
<a href="#" onclick="OpenWebDavDocument('bfd42001/hownow/files/Records/12182', 'xlsx')" style="">Excel Doc</a>
<a href="#" onclick="OpenWebDavDocument('hbfd42001/hownow/files/Records/8924', 'docx')" style="">Word Doc</a>
</body>
</html>
在 FireBug 中检查时出现以下错误:
hownowPlugin.EditDocument2 不是一个函数
谁能指出我哪里出错了?
最佳答案
为了使链接正常工作,我还进行了一项额外更改。
目前,您拥有:
hownowPlugin.EditDocument2(url, null);
我删除了 2:
hownowPlugin.EditDocument(url, null);
FFWinPlugin 的文档可以在 http://msdn.microsoft.com/en-us/library/ff407576.aspx 找到。 .
我正在做一个类似的项目,我需要支持多个浏览器。我最初的编辑代码来自 Milton ( http://milton.io/index.html )。它只在 IE 中有效。将 IE 代码和 Firefox 代码汇集在一起,我得出了这个结论。
<script type="text/javascript">
var fNewDoc = false;
var EditDocumentButton = null;
try {
EditDocumentButton = new ActiveXObject('SharePoint.OpenDocuments.3');
if (EditDocumentButton != null) { fNewDoc = true; }
} catch(e) {}
var L_EditDocumentError_Text = "Editing not supported.";
var L_EditDocumentRuntimeError_Text = "Sorry, couldn't open the document.";
function editDocument(strDocument) {
if (fNewDoc) {
if (!EditDocumentButton.EditDocument(strDocument)) {
alert(L_EditDocumentRuntimeError_Text);
}
} else {
try {
var hownowPlugin = document.getElementById("winFirefoxPlugin");
hownowPlugin.EditDocument(strDocument, null);
} catch (e) { alert(L_EditDocumentError_Text); }
}
}
</script>
<object id="winFirefoxPlugin" type="application/x-sharepoint" width="0" height="0" style="visibility: hidden;"></object>
关于javascript - MS Office Firefox 插件 (NPAPI),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8706668/