drawImage don't work on chrome extention
- by shrwea
I use canvas drawImage in popup.html. But it doesn't work.
Please advise me.
popup.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<canvas id="test"></canvas>
<script src="test.js"></script>
</body>
</html>
test.js
var image = document.createElement("img");
image.src = "test.png";
image.onload = function(){
var canvas = document.getElementById('test');
var ctx = canvas.getContext('2d');
ctx.drawImage(image, 0, 0);
}