javascript-ecdc icon indicating copy to clipboard operation
javascript-ecdc copied to clipboard

Ajax: Cross Domain Request

Open alexcostars opened this issue 11 years ago • 1 comments

Hello Mikhail, through some changes I plan to separate the Client Server. Today the project is official because the client runs on the same server (and in the same folder) to the server.

In my effort to separate the two (allow to run on two different machines without using the same files) I came across a problem. In constructing the EcdcClient is set the script to be processed. I do not consider my project have the correct Client Script in your directory, but the server.

Bottom line: I wish I could get the script from another domain than the site

var client = new EcdcClient ({
     script: '/Md5BruteForceWorker.js' // Worker script 
     count 1, count // Workers 
     AutoStart: false // Auto start? 
}); 

I tried changing that statement to get the script from an external domain, for example: http://example.com/Md5BruteForceWorker.js, but it generates error on Cross Domain Ajax Request.

Do you have any idea how I can fix this? thanks :)

alexcostars avatar Aug 12 '14 16:08 alexcostars

You static server should add Access-Control-Allow-Origin: * header to every resource it serve in order to allow loading remote scripts. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

azproduction avatar Aug 13 '14 15:08 azproduction