欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

 更新時間:2013年06月12日 12:46:19   作者:  
在使用 UEditor 編輯器 時遇到了跨域的問題,導致無法發(fā)圖片,原因是由于 iframe 中的 src 跨域造成的

解決的方法:

1.在 ueditor\dialogs\internal.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('baidu_editor_' + this.uid).src = "javascript:(function(){document.open();document.domain='"+document.domain+"';document.close();})()";
}

接下來找到:

me.document = doc;

在它下邊加入:

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

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

作者:東奎 

相關文章

最新評論