• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to use javascript to download the file automatically?

 
jing hu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I have many URL. Theses URL are similar.
the url code is like below.

I want to download the file whose title value is name1. So in the below page I can click the download button, and I will download the wanted file.

But the number url info is so big. I can't download it manually。
So I want to use javascript to download these file automatically.

In Javascript, I know we can use nsIWebBrowserPersist. saveURI (
nsIURI URI ,
nsISupports cacheKey ,
nsIURI referrer ,
nsIInputStream postData ,
char* extraHeaders ,
nsISupports file
) to download the wanted file.

but in below html code I find I can't get the wanted file url. It do a __doPostBack opertion to sumit a form and finish the downloading task.

So how can I use javascript to download the file automatically?
Any reply will be thankful。

Thanks very much.


 
jing hu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because in input __VIEWSTATE value is so long , I paste it here.

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTczMTY1NDE3MA8WCh4QdnNDcmVhdGVPck1vZGlmeWQeFHZzQ3VycmVudEFjY2Vzc29yeUlEZB4HdnNTYXZlZAUBZh4JUHJvamVjdElEBRNQTjIwMDkwNTA2MTcwMTA1OTM3HghVcGxvYWRlcgUHaHVvZmFuZxYCAgMPZBYGAgQPPCsADQEADxYGHgtfIURhdGFCb3VuZGceCVBhZ2VDb3VudAICHgtfIUl0ZW1Db3VudAIIZBYCZg9kFhBmD2QWCAIFDw8WAh4HVmlzaWJsZWhkZAIGDw8WAh8IaGRkAgcPDxYCHwhoZGQCCA8PFgIfCGhkZAIBD2QWEGYPDxYCHgRUZXh0BSLpqbvlnLDnvZHnq6Plt6Xmlofku7Yt6YeR5Z+657+g5Z+OZGQCAQ8PFgIfCQUG5byg5YGlZGQCAg8PFgIfCQULMTM3NzA3ODY1NjRkZAIDDw8WAh8JBRIyMDA5LTYtMTYgMTc6NTk6MDlkZAIFDw8WBB8JBSguLi9VcGxvYWQvMjAwOTA2MTY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