Home:ALL Converter>How to download a file from a url with Javascript?

How to download a file from a url with Javascript?

Ask Time:2010-11-30T07:05:41         Author:Ricardo Rod

Json Formatter

How to download a file from a url with Javascript?

I'm trying to get from a textfield a user enters a url as follows:

new Ext.form.TextField({
                disabled: false,
                        fieldLabel: "file",
                        value:'',
            id:"url"};

and I need the value of this variable is the file contained in the above url I am trying as follows:

var file1 = new OpenLayers.WPS.ComplexPut({
                      identifier: "file1",
                      value: window.location.href = document.getElementById("url")

Author:Ricardo Rod,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/4309009/how-to-download-a-file-from-a-url-with-javascript
elasticrat :

You can use jQuery to load anything from an URL quite easily with:\n\n<script>\n $(\"#loadhere\").load(\"http://www.google.com\");\n</script>\n",
2010-11-30T00:19:14
yy