首页 > Web开发 > 详细

UEditor 编辑器跨域上传解决方法

时间:2015-12-05 07:06:28      阅读:323      评论:0      收藏:0      [点我收藏+]

解决的方法:

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 跨域传图片的问题,希望对大家有所帮助。

作者:东奎 

UEditor 编辑器跨域上传解决方法

原文:http://www.jb51.net/article/38334.htm

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!