javascript - MS Office Firefox 插件 (NPAPI)

标签 javascript firefox ms-office

我在使用 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/

相关文章:

javascript - 如何使用 ZURB Foundation 6 折叠所有打开的 Accordion

javascript - NodeJS、Firestore 获取字段

javascript - Internet Explorer 打开 Outlook 约会 javascript

c# - VSTO 以编程方式添加基于现有工作表的新工作表

ms-office - 如何在 C# 中运行时连接到 Outlook 2010?

c# - 使用 C# 在 Excel 中更改单元格颜色

javascript - javascript 中的 xsl 转换器?

javascript - 相同的选择器在常规浏览器和 Selenium 中给出不同的结果

javascript - Jquery .show() 和 .hide() 甚至 .css( {"display":"none"});不在火狐浏览器中工作?

javascript - AJAX 在 Firefox 中无法正常工作