merdolator
09-24-2003, 02:28 PM
i may be using the wrong code here, but it seems to work all except that it only recognizes .html and .txt formats to save as... thats fine if it is text or html... but what its it is an .exe or an .mp3?
here's my code:
(in the <head>section)
<script>
function saveAsMe (filename)
{
document.execCommand('SaveAs',null,filename)
}
</script>
(in the <body>section)
<form name="TheForm">
<input type=button value="Save As" onclick="saveAsMe('replacethiswiththefileofyourchoice.exe');">
</form>
reasons for trying to accomplish this:
1) sometimes peoples browsers are set up to run or play (.exe and .mp3 files respectively) instead of downloading.
2) would like to be able to use this in conjunction with disable right click script.
3) attempting test for use with .swf files where left click for link is only option (right click gives flash player info)
if someone could direct me in the right way i would be most thankful. i am not sure i am using the correct objects to invoke. maybe its not a document but a target file, but i am not sure how to reference that properly.
here's my code:
(in the <head>section)
<script>
function saveAsMe (filename)
{
document.execCommand('SaveAs',null,filename)
}
</script>
(in the <body>section)
<form name="TheForm">
<input type=button value="Save As" onclick="saveAsMe('replacethiswiththefileofyourchoice.exe');">
</form>
reasons for trying to accomplish this:
1) sometimes peoples browsers are set up to run or play (.exe and .mp3 files respectively) instead of downloading.
2) would like to be able to use this in conjunction with disable right click script.
3) attempting test for use with .swf files where left click for link is only option (right click gives flash player info)
if someone could direct me in the right way i would be most thankful. i am not sure i am using the correct objects to invoke. maybe its not a document but a target file, but i am not sure how to reference that properly.