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