java - jquery/javascript: download a file from any webserver -
I am creating a JS / JQUERY web application that can be able to download 3D geometry files from any server And then display that file in the window The following functions work locally for this purpose:
function file_download (filename, callback) {var model = new object (); $ .jax ({url: filename, data type: 'text', success: work (data) {model = new obj_create (data); callback (model);}}); }
However, whenever I try to input a URL which is outside the server, I get the following error:
XMLHttpRequest not loaded Can do '& lt; URL here & gt; 'No access-control-permission-origin' header on requested resource is present Original '& lt; My local server URL & gt; ' So login is not allowed
The file can be opened manually in my browser, but can not be automatically captured through AJAX.
I have tried to do this with a CORS request, but I can see that I need to be able to edit the permissions on the target server. I need to be able to download files from an arbitrary webserver.
I did this before uploading an image in the forums to select user icons. Can it be done with JS and Junkie? If I want I can use PHP, but I have been asked to avoid it.
To sign a cross-domain you want, you have to take a look at this:
Cross-Origin Resource Sharing (CORS) is a W3C space that allows cross-domain communication from the browser. By producing above the XMLHttpRequest object, CORS allows developers to work with idioms similar to the same-domain requests.
Comments
Post a Comment