2017-08-10 301 views
0

我目前正在開發一個Word加載使用Word API爲Microsoft Office專業版2016,我採用了棱角分明4.字API發送HTTP請求

我有問題與Internet Explorer 11的時候我試圖發送HTTP請求(例如GET,POST)。在其他瀏覽器中一切正常,但在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使用不同的瀏覽器。但是,在這種情況下,它表示加載項無法正常運行。

有誰知道如何解決這個問題?

+0

你能否提供你正在使用,以使這些請求的代碼?這個錯誤被截斷得太多以至於無法理解它。 –

+0

好吧,我加了:) –

回答

0

這裏是代碼我使用:

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 

       } 
      ); 
    } 
}