In a webbrowser preferably google chrome, using JavaScript can we access and manipulate the data fetched by various html media elements like img
, video
? And save the resource or some data using javascript?
I want to do something like this
var myvideo=document.getElementById("myvideo");
if(window.save(myvideo.data,"myvideo.mp4")){
console.log("video saved successfully.");
}else{
console.log("save operation canceled by user");
}
and
var myfile="Some text file content";
if(window.save(myfile,"myfile.txt")){
console.log("video saved successfully.");
}else{
console.log("save operation canceled by user");
}
did any popular browser capable of doing this and how? Is it in HTML5 standard? Though the save is done on users permission Are there still any security issues in implementing above?
--EDIT--
Google chrome extension,singleFile is able to do that. It is inserting raw media data into html file. Am I wrong? If so what is the singleFile's approach in obtaining the raw media data.