首頁 >php教程 >PHP开发 >UEditor 編輯器跨網域上傳解決方法

UEditor 編輯器跨網域上傳解決方法

高洛峰
高洛峰原創
2016-12-27 09:20:181363瀏覽

解決的方法:

1.在ueditordialogsinternal.js 加入document.domain = '根域名';

2.在當前頁面同樣指定根域名:

<script type="text/javascript">
    document.domain = "根域名";
</script>

這樣在chrome、firefox 下沒有問題,但在ie下方還需要簡單修改下UEditor,在editor.js 中找到:

this._setup( container.firstChild.contentWindow.document );

在它上邊加入下邊的程式碼:

if (ie) {
    document.getElementById(&#39;baidu_editor_&#39; + this.uid).src = "javascript:(function(){document.open();document.domain=&#39;"+document.domain+"&#39;;document.close();})()";
}

接下來找到: .document = doc;

在它下邊加入:

me.document.domain='根域名';

到這裡就解決了UEditor 跨域傳圖片的問題,希望對大家有所幫助。



更多UEditor 編輯器跨域上傳解決方法相關文章請關注PHP中文網!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn