This article introduces the UEditor cross-origin File Upload implementation method. Many users encounter cross-origin problems when using the UEditor, leading to the inability to send images, the reason is that the src cross-origin in iframe is caused. The solution is described below.
Solution:
1. Add document. domain = 'root domain name' in ueditordialogsinternal. js ';
2. Specify the root domain name on the current page:
The Code is as follows: |
Copy code |
<Script type = "text/javascript"> Document. domain = "Root domain Name "; </Script> |
In this way, there is no problem in chrome and firefox, but you still need to modify UEditor in ie and find in editor. js:
The Code is as follows: |
Copy code |
This. _ setup (container.firstchild.content1_doc ument); Add the following code to it: If (ie ){ Document. getElementById ('Baidu _ editor _ '+ this. uid ). src = "javascript :( function () {document. open (); document. domain = '"+ document. domain + "'; document. close ();})()"; } |
Next, find:
The Code is as follows: |
Copy code |
Me.doc ument = doc; |
Add:
The Code is as follows: |
Copy code |
Me.doc ument. domain = 'root domain name '; |
Here we have solved the problem of cross-origin image transfer by UEditor, and hope to help you.