I'm currently trying to change style elements for this Google-tasks gadget:
https://mail.google.com/tasks/ig
using a chrome content script.
In this example, I'm removing the toolbar at the bottom. Because Google is generating the HTML with javascript, and puts it in an iframe. I need to use this code:
document.getElementsByTagName('iframe')[0].contentWindow.document.getElementById(':1.ft').style.display = 'none'
When you run this code from the developer console, it hides the toolbar. But it doesn't work as content script.
I thought this is because the code is run before the page is ready. So I tried to use an event listener:
document.addEventListener("DOMContentLoaded", function () {
document.getElementsByTagName('iframe')[0].contentWindow.document.getElementById(':1.ft').style.display = 'none'
}, false);
but that didn't work either. Also tried the event listeners 'domready' and 'load'. But none of them worked.
How do I get that element?