【问题标题】:FFWinPlugin application/sharepoint-x fails after page refreshFFWinPlugin application/sharepoint-x 在页面刷新后失败
【发布时间】:2013-05-24 07:43:48
【问题描述】:

我正在尝试使用 FFWinPlugin 插件从 google chrome 或 firefox 访问 webdav 内容。 webdav 服务器使用 ITHit webdavsystem。

问题在于,虽然它最初可以工作,但在刷新网页后,对 EditDocument 的所有进一步调用都失败且没有错误 - 根本没有发出 webdav 请求。这会影响从任何网页对任何 webdav 服务器的所有后续调用。需要重新启动浏览器(或者,对于 chrome,可以杀死“Microsoft Office 2013”​​插件任务)才能恢复。

示例代码如下:

<script>
function test() {
  var sharepoint = document.getElementById("winFirefoxPlugin");

  sharepoint.EditDocument(getLocationRoot() + "/word.docx");
}

function getLocationRoot() {
  return location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : '');
}
</script>
<object id="winFirefoxPlugin" type="application/x-sharepoint" width="0" height="0" style="visibility:hidden;"></object>
<button onclick="test()">test</button>

我正在使用 Firefox 版本 20.0.1 和 chrome 版本 27.0.1453.93m 使用 Office 2013 对此进行测试。

在 IE 上使用 OpenDocuments control 没有问题。

我没有要测试的共享点服务器。任何人都可以确认/否认它有同样的问题吗?

有没有人遇到过这个问题和/或有解决方案?在我看来,这是 Microsoft 插件的问题。

【问题讨论】:

    标签: google-chrome firefox webdav ithit-webdav-server


    【解决方案1】:

    我没有在 office 2013 中尝试过,但下面的代码在 office 2010 中对我有效。您的代码和我的代码之间的唯一区别是插件对象是动态添加的。

    getOrCreateContainer: function(containerId)
    {
      var container = Ext.get(containerId);
      if (container)
        return container;
    
      container = new Ext.Element(document.createElement('div'));
      container.id = containerId;
      container.setStyle({ width: '0px', height: '0px', position: 'absolute', overflow: 'hidden', top: '-1000px', left: '-1000px' });
    
      Ext.getBody().appendChild(container);
      return container;
    },
    
    getOrCreateSharePointPluginContainer: function()
    {
      var sharePointPluginContainer = this.getOrCreateContainer('_sharePointPluginContainer');
      if (!sharePointPluginContainer.first())
      {
        var domObj = Ext.DomHelper.createDom(
          {
            tag: 'object',
            type: 'application/x-sharepoint',
            style: { visibility: 'hidden', width: '0px', height: '0px' }
          }
        );
        sharePointPluginContainer.appendChild(new Ext.Element(domObj));
      }
    
      return sharePointPluginContainer;
    },
    
    
    sharePointEditDocument: function (sUrl)
    {
    
      try
      {
        var sho = this.getSharePointOpenDocumentsCtrl();
        if (sho)
        {
          if (!sho.EditDocument(sUrl))
          {
            //todo: use localized message
            alert('Cannot edit file');
            return false;
          }
        }
      }
      catch (e)
      {
        return false;
      }
    },
    
    getSharePointOpenDocumentsCtrl: function ()
    {
      if (this._sharePointOpenDocumentsControl == null)
      {
          this._sharePointOpenDocumentsControl = this.getOrCreateSharePointPluginContainer().first().dom;
      }
      return this._sharePointOpenDocumentsControl;
    },
    

    请注意以下几点:

    • 代码使用 ExtJs - 您需要使用直接 DOM 调用或 jQuery 调用替换现有的 ExtJs 代码,具体取决于您使用的库
    • 你可以简化代码,它看起来像这样是因为它有一些我取出的代码

    【讨论】:

      【解决方案2】:

      这个帮助

      sharepoint.EditDocument(getLocationRoot() + "/word.docx"+"\0");
      

      更多: [https://code.google.com/p/chromium/issues/detail?id=269183#makechanges]

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-01-26
        • 2014-08-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多