2016-07-13 27 views
3

我有一個存儲ckeditor的中央位置。當在兩個應用程序中使用ckeditor時,不會在IE中加載

標題web應用程序在IE,Firefox和Chrome中成功使用ckeditor。

標題始終爲域中的所有Web應用程序加載。

Web應用程序X需要ckeditor。 Web應用程序等待(使用超時)CKEDITOR對象可用,然後使用它。

這適用於Chrome和Firefox,但不適用於IE。我在這裏錯過了什麼?

IE中的超時持續進行,但CKEDITOR對象從不可用。

代碼:

namespace Models 
{ 
    using System.ComponentModel.DataAnnotations; 

    public class EmailModel 
    { 
     public int EmailID { get; set; } 
     public string FromAddress { get; set; } 
     public string ToAddresses { get; set; } 

     [Required(ErrorMessage = "Subject is required.")] 
     [StringLength(50, ErrorMessage = "Subject cannot be greater than 50 characters.")] 
     public string Subject { get; set; } 

     [Required(ErrorMessage = "Body is required.")] 
     public string Body { get; set; } 
    } 
} 

HTML:

@model Models.EmailModel 

@{ 
    ViewBag.Title = "Email Template Details"; 
} 

<h2>Email Template Details</h2> 

<script type="text/javascript" src="~/Scripts/EmailDetails.js?version=06.07.2016_1156"></script> 

<div> 
    <hr /> 
    <dl class="dl-horizontal"> 
     <dt> 
      @Html.DisplayNameFor(model => model.FromAddress) 
     </dt> 

     <dd> 
      @Html.DisplayFor(model => model.FromAddress) 
     </dd> 

     <dt> 
      @Html.DisplayNameFor(model => model.Subject) 
     </dt> 

     <dd> 
      @Html.DisplayFor(model => model.Subject) 
     </dd> 

     <dt> 
      @Html.DisplayNameFor(model => model.Body) 
     </dt> 

     <dd> 
      @Html.HiddenFor(model => model.Body) 
      <textarea id="editorBodyDetails" name="editorBodyDetails" style="display:none"></textarea> 
     </dd> 

    </dl> 
</div> 
<p> 
    @Html.ActionLink("Edit", "Edit", new { id = Model.EmailID }) | 
    @Html.ActionLink("Email Templates", "Index") 
</p> 

腳本:

var countCKEDITORAttemps = 0; 

$(function() { 

    initializeCKEDITOROnceLoaded(countCKEDITORAttemps); 

}); 

function initializeCKEDITOROnceLoaded(countCKEDITORAttemps) { 
    var interval = 1000; // ms 
    if (countCKEDITORAttemps < 100) { 
     window.setTimeout(function() { 
      if (typeof(CKEDITOR) !== 'undefined') { 
       setupCKEditor("editorBodyEdit"); 
      } else { 
       countCKEDITORAttemps = countCKEDITORAttemps + 1; 
       console.log("Loading CKEDITOR:" + countCKEDITORAttemps * 1000 + "milliseconds"); 
       window.setTimeout(initializeCKEDITOROnceLoaded(countCKEDITORAttemps), interval); 
      } 
     }, interval); 
    } 
} 

function setupCKEditor(id) { 
    CKEDITOR.replace(id, { height: 200, }); 
    CKEDITOR.instances[id].setData($("#Body").val()); 
} 

注意:我不包括在Web應用程序中X

線CKEditor的處ckeditor載入IE中似乎有一個問題是:

var b=d[c].src.match(a); 

「src」不可用。這可能是導致IE加載中出現問題的原因嗎?

「錯誤::負載期間

錯誤消息無效參數\ n在匿名功能(http://domain.com/includes/ckeditor/ckeditor.js?anti-cache=09Jun2016&=1468730100637:5:431)\ n在匿名功能(http://domain.com/includes/ckeditor/ckeditor.js?anti-cache=09Jun2016&=1468730100637:5:153)\ n在匿名功能(http://domain.com/includes/ckeditor/ckeditor.js?anti-cache=09Jun2016&=1468730100637:5:78)\ n在全局代碼(http://domain.com/includes/ckeditor/ckeditor.js?anti-cache=09Jun2016&=1468730100637:5:2 )「

+0

請提供您正在使用的HTML,並在可能的情況下提供演示問題的小工具。 – Dekel

回答

1

我能夠通過檢查我的應用程序中正在加載的所有腳本來解決問題。其中一個腳本加載有問題,並阻礙了IE上ckeditor的加載。

-1

您還可以通過更改應用程序中腳本的順序來解決此問題。

相關問題