-1

So guys I am working on a program to like download stuff using javascript. I hav written the following code:

function download()
{
   alert("Hello");
   var url='http://somesite/somefile.rar';  
   window.open(url,'Download');
}

The code is pretty easy, but is there some other way to download the file using javascript? Also having downloaded the file is there some way to store it locally in the location of our choice, like d-drive? I had come across the javascript file api while searching the web, is it any useful in my scenario? Please help.

Edit: Fixed code formatting

1
  • 3
    Please fix your question title. We know it's about "Javascript" as that's what the tags say, and everybody who posts a question wants "help". (In fact, looking at your profile, all your question titles are "Need help with X"!!) I took care of the reformatting for you. Commented Jul 4, 2011 at 16:45

2 Answers 2

1

No, this isn't possible. It is up to the client where to save files, not you.

Sign up to request clarification or add additional context in comments.

Comments

0

Through Javascript, you can only set the file name that you want, but would not be able to access the file system i.e. All the folders, etc..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.