Monday, December 10, 2012

my jquery sample source log:save media file not play media file

'saveas':function (url){
setTimeout(function(){
var id = "saveasiframeobj_objhelper";
var obj = document.getElementById(id);
if(!obj){
obj = document.createElement("a");
obj.target="_blank";
obj.id=id;
obj.style.display = "none";
obj.download='';
document.body.appendChild(obj);
}
obj.href = url;
obj.click();
},0);
}



note: obj.download attribute. this is used by browser to download, not play it .it can replace system saveas method. good prefected for pkrss.


if you want to special the save as downloadfilename.postfix,you can like this:

obj.download='downloadfilename';



this is from my project http://www.pk17s.cn ‘s part source sample. you can used anytimers.

No comments: