azproduction / javascript-ecdc

JavaScript Elastic Cloud for Distributed Computing - framework for creating browser-based distributed computing applications based on Node.js
39 stars 2 forks source link

Ajax: Cross Domain Request #2

Open alexcostars opened 10 years ago

alexcostars commented 10 years ago

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 :)

azproduction commented 10 years ago

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