Search code examples
javascripthtmltinymcefckeditor

Error uploading images with FCKEditor/TinyMCE


I have this error on a page every time they want to upload an image.

Uncaught DOMException: Blocked a frame with origin "example.net" from accessing a cross-origin frame.
    at OpenFile (example.net/tiny_mce/plugins/simplebrowser/frmresourceslist.html:98:20)
    at HTMLAnchorElement.onclick (example.net/tiny_mce/plugins/simplebrowser/frmresourceslist.html:1:1)

Deactivating the Same-Origin Policy makes that uploading a file works without problems but this page is for a company and for the 'user' deactivating this just to upload a file is a headache. Also that is not a real solution...

Code frmresourceslist.html

Another thing is that this worked until we changed servers, or at least they didn't complain until then.

Edit: I've read about adding on the htaccess

Header set Access-Control-Allow-Origin "*"

But it's not working, help?


Solution

  • No idea what it means, but this worked

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^example.net [NC]
    RewriteRule ^(.*)$ http://www.example.net/RewriteRule ^(.*)$ http://www.example.net/$1 [L,R=301,NC]
    
    <IfModule mod_headers.c>
    
    Header always append X-Frame-Options SAMEORIGIN
    Header always set Access-Control-Allow-Origin "*"
    Header add Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"
    Header always set Timing-Allow-Origin "*"
    
    </IfModule>