...

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



kiransoanje
06-16-2004, 12: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

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

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


Can u plz help me out

kwhubby
06-17-2004, 09: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.

glenngv
06-17-2004, 10: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>

or

<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>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum