Word api 在 IE11 DOMException 错误中发送 http 请求



我目前正在为Office Professional 2016开发Word API Microsoft Word加载项。我正在使用 Angular 4。

我在尝试发送HTTP请求(例如GET,POST(时遇到Internet Explorer 11问题。在其他浏览器中一切正常,但在IE中我收到此错误:

object DOMException] {
ABORT_ERR: 20,
code: 11,
constructor: DOMException { ...
},
DATA_CLONE_ERR: 25,
DOMSTRING_SIZE_ERR: 2,
HIERARCHY_REQUEST_ERR: 3,
INDEX_SIZE_ERR: 1,
INUSE_ATTRIBUTE_ERR: 10,
INVALID_ACCESS_ERR: 15,
INVALID_CHARACTER_ERR: 5,
INVALID_MODIFICATION_ERR: 13,
INVALID_NODE_TYPE_ERR: 24,
INVALID_STATE_ERR: 11,
message: "InvalidStat...",
name: "InvalidStat...",
NAMESPACE_ERR: 14,
NETWORK_ERR: 19,
NO_DATA_ALLOWED_ERR: 6,
NO_MODIFICATION_ALLOWED_ERR: 7,
NOT_FOUND_ERR: 8,
NOT_SUPPORTED_ERR: 9...
}

我在Internet Explorer和Edge上使用Word在线有同样的问题。 它在不同的浏览器中工作正常。 我还从Windows卸载了Internet Explorer,以"强制"Word使用不同的浏览器。但是,在这种情况下,它说加载项无法正常运行。

有人知道如何解决这个问题吗?

这是我正在使用的代码:

import { Injectable } from '@angular/core';
import { Http, Headers, RequestOptions } from '@angular/http';
import { globalUrl } from '../../common/globalUrl';
@Injectable()
export class LoginService {
constructor (private _http: Http) { }
authenticate(documentDir: string,packageSize:any) {
const headers = new Headers();
headers.set('content-type', 'application/json');
let options = new RequestOptions({ headers: headers });
const body={documentDir,packageSize};
this._http.post(globalUrl("create-document"),body,options)
.map(res => res.json())
.subscribe(
(data) => {
console.log(data);
},
(err) => {
console.log(err); //here appears the error 
}
);
}
}

最新更新