I have various types of files on my site the user can download. All files download like a charm except media files like mp3, mp4 etc. When the user clicks on mp3 etc downloads, a new tab opens and plays the media file instead of showing the download popup... Any ideas?
Apologies that I couldn't find exact issue on the net... All other answers shows the question the other way around.
function get_dl(e){
var x = $('[name='+ e +']').attr('value');
//sample code from w3schools
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (this.readyState==4 && this.status==200) {
window.open(this.responseText, '_blank');
//This line is where I'm stuck
}
}
xmlhttp.open("GET","getfile.php?q=" + x,true);
xmlhttp.send();
}
All other files show's the download popup, except media files, they auto-play instead of downloading...