Possible Duplicate:
how to get body content of iframe by javascript?
I am creating a Chrome extension and I want to be able to access an element within an iframe. So far I am able to access the iframe, but when i go to access the element I want it returns the error "Uncaught TypeError: Object # has no method 'getElementById'". the canvas element in the iframe has id of "canvas".
var divElement, iframeElement, canvasElement;
if (document.getElementById("puzzle")) {
divElement = document.getElementById("puzzle");
iframeElement = divElement.getElementsByTagName("iframe")[0];
canvasElement = iframeElement.getElementById("canvas");
console.log(canvasElement);
}