PDA

View Full Version : download button script



krkalaf
04-15-2008, 02:39 PM
Anybody got a 'download now' button script?
Client wants people to download wmv file.
I want to bypass 'right click' 'save file as'....

hmsnacker123
04-15-2008, 06:22 PM
This is what i do:

put this script right befor the </body> tag:

<script language="javascript" type="text/javascript">
<!--
function download(url) {
newwindow=window.open(url,'name','height=1,width=1');
if (window.focus) {newwindow.focus()}
return false;
}

// -->
</script>

then put this link into your document:

<a href="#" onclick="return download('1.htm')">Click Here</a>




after you have downloaded the files edit 1.htm:


<script type="text/javascript">



var browser_type=navigator.appName
var browser_version=parseInt(navigator.appVersion)
if (browser_type=="Netscape"&&browser_version>=5)
window.location.replace("Your Filename Here")
else if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4)
window.location.replace("Your Filename Here")
else if (browser_type=="Netscape"&&browser_version>=4)
window.location.replace("Your Filename Here")
else
window.location="Your Filename Here"
</script>

download the files below:
(put all the files in the same directory)

krkalaf
04-15-2008, 07:14 PM
I'll give it a try!

Thanks:D

krkalaf
04-15-2008, 07:48 PM
Ok. It plays the video in mp when page is opened but no download window or option to download file appears.

I'll keep playing with it.