I'm creating a simple user script to Greasemonkey and I want to select an
node that is inside of an iframe document. The node that I want to select
is an <embed> that is in an iframe document hosted in other domain:
<iframe style="height: 631px;" class="smart_sizing_iframe" scrolling="no"
id="iframe_canvas" name="iframe_canvas_fb_https" src="javascript:"""
webkitallowfullscreen="" mozallowfullscreen="" oallowfullscreen=""
msallowfullscreen="" allowfullscreen="" height="800" frameborder="0">
<html>
<body>
<div>
<div>
<embed style="display: block; width: 1325px; height: 631px;
margin-left: 15px; margin-top: 0px;" disablecontextmenu="true"
progressframeimage="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yO/r/xE2zuu-toia.png"
progressbarimage="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yV/r/cIFShcsRTg9.png"
logoimage="https://fbcdn-photos-f-a.akamaihd.net/hphotos-ak-xpa1/t39.2081-0/p128x128/851582_531935076922613_15198766_n.png"
firstframecallback="UnityObject2.instances[0].firstFrameCallback();"
type="application/vnd.unity"
src="https://deadtrigger2-fb.ssl.hwcdn.net/0.7.0-rc1-r49324/DeadTrigger2.unity3d"
height="631" width="1354">
</embed>
</div>
</div>
</body>
</html>
</iframe>
My JavaScript lines (I set @include for both domains):
// @include https://*.facebook.com/deadtrigger_ii/
// @include https://integrated-plugin-canvas-*-*.fbsbx.com/apps/*/?params=*
var iframe = document.getElementById('iframe_canvas');
var otherdocument = iframe.contentDocument || iframe.contentWindow.document;
var unity = otherdocument.querySelector("embed[type='application/vnd.unity']");
unity.style.setProperty("margin", "0px", "important");
Is there some problem? What do I need to do to get that <embed>?
I'm very amateur in JavaScript, I need help. Thanks.
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.