Question

I am working on adding the contents of an iFrame to the canvas in order to save it as an image. I get the 'canvas.drawWindow is not a function' error in FF.

I understand that this only works with Chrome privileges - How do I enable chrome privileges or how should I avoid the error.

Thanks!

Was it helpful?

Solution

drawWindow() is a method belonging to CanvasRenderingContext2D, not HTMLCanvasElement (canvas) itself. Per the docs, "To get [the context] object, call getContext() on a canvas, supplying "2d" as the argument"

example:

var canvas = document.getElementById('myCanvas');
var ctx = canvas.getContext('2d');
ctx.drawWindow(...);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top