Inside an iframe I need to execute a script which will get a value from the div that wraps around the iframe.

<div style="border-color:red">
<iframe src="" class="the-iframe">
//script executed in the iframe
</iframe>
</div>

Both scripts are on the same domain, although may be different protocols (http/https sometimes).

Also, the iFrame where the script is used will always be the last one in the DOM (if more than one exist).

Neither of these work:

$('iframe').before.css('border-color');
$('.the-iframe').before.css('border-color');
$('iframe', window.parent.document).last.before.css('border-color');

Is it possible, and if so what do I do?