I have an iFrame, where I want to send a JavaScript command after loading. My current code looks like this:
document.querySelector("iframe").addEventListener( "load", function(e) {
this.style.backgroundColor = "red";
alert(this.nodeName);
console.log(e.target);
} );
<iframe src="example.com" ></iframe>
Your code is correct. Just test to ensure it is being called like:
<script>
function doIt(){
alert("here i am!");
__doPostBack('ctl00$ctl00$bLogout','')
}
</script>
<iframe onload="doIt()"></iframe>
Use the iFrame's .onload
function of JavaScript:
<iframe id="my_iframe" src="http://www.test.tld/">
<script type="text/javascript">
document.getElementById('my_iframe').onload = function() {
__doPostBack('ctl00$ctl00$bLogout','');
}
</script>
<!--OTHER STUFF-->
</iframe>