2

我已将 WebDAV 服务器集成到我的网站中(使用 IT Hit 的产品),以允许用户对 Office 文档进行“在线编辑”,而无需下载和重新上传。除了用户第一次尝试打开链接外,它通常似乎可以工作,它始终是只读的。在他们第一次打开任何 WebDAV 链接后,它似乎工作正常。查看 Fiddler,与后续时间相比,第一次打开文件的请求集有所不同。

第一次(HTTP 方法 - URL - 用户代理):

GET - Files/doc.docx - Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64;   Trident/6.0)
OPTIONS - Files/ - Microsoft Office Protocol Discovery
OPTIONS - Files/ - Microsoft Office Excel 2013
HEAD - Files/doc.docx - Microsoft Office Excel 2013
GET - Files/doc.docx - Microsoft Office Excel 2013
PROPFIND - Files/doc.docx - Microsoft Office Excel 2013

随后的时间:

OPTIONS - Files/ - Microsoft Office Excel 2013
HEAD - Files/doc.docx - Microsoft Office Excel 2013
LOCK - Files/doc.docx - Microsoft Office Excel 2013
GET - Files/doc.docx - Microsoft Office Excel 2013
PROPFIND - Files/doc.docx - Microsoft Office Excel 2013

当您在每种情况下单击链接时,浏览器也会以不同的方式处理链接。第一次,它会打开通常的打开/另存为/取消框,但之后会出现一个 Microsoft Office 对话框,询问您是否要打开此文件。

It does not seem to be just my implementation though, as the same behaviour happens when using this: http://ajaxbrowser.com/ (you need to be in IE).

I have tried intercepting the requests that are not going to work by checking the user agent but it seems that stops it working out how to open the links correctly in future.

Has anyone come across this before and found a way around it? It isn't great if the first time a user tries the new functionality, it doesn't work. It also isn't that obvious that it hasn't worked and I can easily see some users saving the read only file locally and expect that it has synced with the server. Any solution that would avoid that situation is welcome.

4

1 回答 1

2

This turns out to be a bug relating to Office 2013. It seems to work fine for Office 2010.

我让 IT Hit 看一下,如果您使用以下 javascript 打开链接,他们找到了解决方法:

window.location('ms-word:ofe|u|' + documentLocation);

其中 agent 是 ms-word 可以根据文件类型替换为 ms-excel。

于 2013-08-19T12:01:21.917 回答