A
A
ajaxtelamonid2014-06-03 09:12:44
JavaScript
ajaxtelamonid, 2014-06-03 09:12:44

ckeditor editor and elfinder 1.x file storage on another domain

Tell me how to implement such a thing?
I want to physically separate the file storage and the main site so that it is hosted in different places.
In the ckeditor settings, I connect elfinder as usual:

filebrowserBrowseUrl : 'http://files.domain.ru/elfinder/elfinder.php'

The elfinder pop-up window appears when you click the file insert icon in the editor, everything is ok. The problem is that when I try to select a file and pass the html code for displaying a link to the file to the editor, I get the following in the elfinder window in the console:
Uncaught SecurityError: Blocked a frame with origin " files.domain.ru " from accessing a frame with origin " domain.ru ". Protocols, domains, and ports must match.
This error fires on window.opener in the script, which is located on the elfinder page:
$().ready(function() {
    var funcNum = window.location.search.replace(/^.*CKEditorFuncNum=(\d+).*$/, "$1");
    var langCode = window.location.search.replace(/^.*langCode=([a-z]{2}).*$/, "$1");
     $('#finder').elfinder({
       url : 'connectors/php/connector.php',
       lang : langCode,
       places: "", // отключить избранное
       editorCallback : function(url) {
          window.opener.CKEDITOR.tools.callFunction(funcNum, url);
          window.close();
       }
    })
  })

Headers 'Access-Control-Allow-Origin: *' in http-response set both files.domain.ru and domain.ru - it doesn't help.
Please tell me how to be?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
3
35e8, 2014-06-05
@35e8

Access-Control-Allow-Origin cross domain ajax header. Does your server support it? I used CORS package for web api (asp.net) ( Microsoft.AspNet.Cors )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question