I'm trying to hide the count value of the Facebook like button when it loads. It runs in an iframe
, like this:
<iframe src="//www.facebook.com/plugins/like.php?href='+'facebook.com'+'&send=false&layout=button_count&width=90&show_faces=false&action=like&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:90px; height:21px;margin:30px 0px 25px 0px;" allowTransparency="true"> </iframe>
So I tried inserting an onload into the iframe tag, such as:
onload="
function loadme() {
// pluginCountTextConnected is the like text count's classname
var x = document.getElementsByClassName('pluginCountTextConnected');
console.log(x);
}
loadme();
"
But the code returns an empty list. I presume the document
reference, in this case, refers to the document that loaded the iframe, not the iframe document. How would I point this to the iframe's content?
Fiddle: here
I should add that the iframe gets loaded from a content-script Chrome extension that runs on Facebook, which is why I was thinking this might not be subject to the same-origin policy.
Update: why did someone vote to close?