Regrettably, achieving this cross-domain is not feasible. I have attempted various methods to manipulate it without success. If there are users willing to use userscripts in your community, that could be a potential option. Otherwise, what you're requesting is simply not doable.
Userscripts
Userscripts are JavaScript scripts (and potentially any accompanying libraries) that users can opt to install in their browsers. While Firefox and Opera offer full support, Firefox requires an extension called Greasemonkey. Chrome has a slight exception: if the library is inactive on the page, you must add both the library and your code directly to the document. Safari compatibility requires an add-on, and Internet Explorer does not support userscripts at all.
To learn more about userscripts, visit this link. Additionally, for ideas and random userscripts, check out userscripts.org.
If working within the same domain, refer to the information below.
Previous Solution
It's indeed achievable to access the top-level document from within an iframe using plain JavaScript. As dynamically created iframes might exist on multiple pages, this script identifies the correct frame:
var arrFrames = parent.document.getElementsByTagName("iframe");
for (var i = 0; i < arrFrames.length; i++) {
if (arrFrames[i].contentWindow === window) alert("Success!");
{
arrFrames[i].contentWindow.style.border = "1px solid lime";
}
}
In jQuery:
parent.$("iframe").each(function(iel, el) {
if(el.contentWindow === window)
{
$(this).css({"border" : "1px solid lime"});
}
});
This code isn't mine. The original version can be found here; I made adjustments for the CSS portion. Remember to thoroughly search next time, as solutions are often readily available!