View Full Version : How download and save the file without forcefully open by browser

06-16-2004, 01:05 PM
Hello Friends,
I want to download and save the file without forcefully open by browser. i have .js file which force the browser to display 'Save As' dialogue box.but the file which i download is blank,
following is the .js file

<script language='javascript'>
function downloadme(x)
myTempWindow = window.open(x,'','left=10000,screenX=10000');
myTempWindow.document.execCommand('SaveAs','null',x); myTempWindow.close();

<a href=javascript:downloadme('\kk.doc');>Download this Doc</a>

Can u plz help me out

06-17-2004, 10:42 AM
With javascript, that is probobly the best way you can do it. you can change mime settings on server side languages and cause it to prompt instead of opening.

06-17-2004, 11:43 AM
This solution is, IMO, the best solution. No need for scripting, thus no need to worry about browser incompatibilities.

<a href="/kk.doc" title="Click to open, Right-click and choose 'Save Target As...' to save.">Doc</a>


<a href="/kk.doc" title="Open document">Doc</a> <span style="font:italic 10px Verdana">(Right-click and choose 'Save Target As...' to save.)</span>