Intra Intra - 1 year ago 85
HTML Question

Change name of download in javascript

If a user clicks on a downloadable link such as

<a href="downloadable.txt">Download</a>

Is there a client-side (html or javascript) way to change the name of the file before the 'Save As' dialog?

Answer Source

No, you cannot change this from the client side (HTML or javascript). You need to change it from the server. One way is to use a server side script which will set the Content-Disposition HTTP response header:

Content-Disposition: attachment; filename=somecustomname.txt
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download