-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.html
More file actions
23 lines (23 loc) · 794 Bytes
/
sample.html
File metadata and controls
23 lines (23 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE html>
<html>
<body>
<script>
function toDataURL(url, callback) {
var httpRequest = new XMLHttpRequest();
httpRequest.onload = function() {
var fileReader = new FileReader();
fileReader.onloadend = function() {
callback(fileReader.result);
}
fileReader.readAsDataURL(httpRequest.response);
};
httpRequest.open('GET', url);
httpRequest.responseType = 'blob';
httpRequest.send();
}
toDataURL('https://www.tutorialspoint.com/videotutorials/images/tutor_connect_home.jpg', function(dataUrl) {
document.write('Result in string:', dataUrl)
})
</script>
</body>
</html>