解決的方法:
1.在 ueditor\dialogs\internal.js 加入 document.domain = '根域名';
2.在當(dāng)前頁面同樣指定根域名:
復(fù)制代碼 代碼如下:
script type="text/javascript">
document.domain = "根域名";
/script>
這樣在 chrome、firefox 下沒有問題,但在 ie 下還需要簡單修改下 UEditor,在 editor.js 中找到:
this._setup( container.firstChild.contentWindow.document );
在它上邊加入下邊的代碼:
復(fù)制代碼 代碼如下:
if (ie) {
document.getElementById('baidu_editor_' + this.uid).src = "javascript:(function(){document.open();document.domain='"+document.domain+"';document.close();})()";
}
接下來找到:
me.document = doc;
在它下邊加入:
me.document.domain='根域名';
到這里就解決了 UEditor 跨域傳圖片的問題,希望對大家有所幫助。
作者:東奎
您可能感興趣的文章:- .NET UEditor使用方法說明
- .NET下為百度文本編輯器UEditor增加圖片刪除功能示例
- ASP.NET中集成百度編輯器UEditor
- 如何在.Net版本UEditor中添加一個普通按鈕
- 利用ASP.NET MVC+Bootstrap搭建個人博客之修復(fù)UEditor編輯時Bug(四)
- 免費開源百度編輯器(UEditor)使用方法
- UEditor編輯器自定義上傳圖片或文件路徑的修改方法
- 關(guān)于UEditor編輯器遠程圖片上傳失敗的解決辦法
- 百度ueditor組件上傳圖片后如何設(shè)置img里的alt屬性
- 一步步教你在Asp.net Mvc中使用UEditor編輯器