3

I'm attempting to use the FFWinPlugin plugin to access webdav content from google chrome or firefox. The webdav server uses ITHit webdavsystem.

The problem is that, whilst it works initially, after refreshing the web page all further calls to EditDocument fail with no error - the webdav request simply isn't made. This affects all subsequent calls to any webdav server from any web page. The browser needs to be restarted (or, in the case of chrome, the "Microsoft Office 2013" plugin task can be killed) to recover.

Example code as follows:

<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>

I am testing this with Office 2013 using firefox version 20.0.1 and chrome version 27.0.1453.93m.

Using the OpenDocuments control on IE works without issues.

I do not have sharepoint server to test against. Can anyone confirm/deny it has the same problem with that?

Has anyone come across this problem and/or have a solution to it? Seems to me this is a problem with the Microsoft plugin.

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
lycandroid
  • 181
  • 10

2 Answers2

1

I haven't tried it with office 2013 but the code below works for me in office 2010. The only difference between your code and mine is that the plugin object is added dynamically.

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;
},

Please note the following:

  • the code uses ExtJs - you need to replace the existing ExtJs code with direct DOM calls or jQuery calls depending on what libraries you use
  • you can simplify the code, it looks like this because it had some code which I took out
boggy
  • 3,674
  • 3
  • 33
  • 56
-1

this help

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

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