【问题标题】:Word api sending http request in IE11 DOMException ErrorWord api 在 IE11 DOMException 错误中发送 http 请求
【发布时间】:2017-08-14 18:57:18
【问题描述】:

我目前正在使用 Word API for Microsoft Office Professional 2016 开发 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 Online 时遇到了同样的问题。它在不同的浏览器中运行良好。 我还从 Windows 中卸载了 Internet Explorer,以“强制”Word 使用不同的浏览器。但是,在这种情况下,它表示加载项无法正常运行。

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

【问题讨论】:

  • 你能提供你用来发出这些请求的代码吗?此错误被截断,无法单独理解。
  • 好的,我加了:)

标签: angular office-js


【解决方案1】:

这是我正在使用的代码:

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 

                }
            );
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-03-08
    • 2019-01-06
    • 2018-01-02
    • 2014-11-26
    • 2017-10-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多