How to detect in post.message null var?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


How to detect in post.message null var?



Hello I need detect if child.php not send message to parent.php, I use the post.message .
I try with:


if (message == null), == false, == "", but not work ..



My code:



parent.php (get the message "work" from child.php if its open)


<button id="open-child-window-2">Open Child Window</button>

<script>

var __CHILD_WINDOW_HANDLE_2 = null;

$("#open-child-window-2").on('click', function() {
__CHILD_WINDOW_HANDLE_2 = window.open('child-2.php', '_blank');
});


window.addEventListener('message', function(e) {
ProcessChildMessage_2(e.data);
} , false);


function ProcessChildMessage_2(message) {
alert(message);
}

</script>



child.php (send to parent.php the message "work" every 0.5 seconds)


<script>

setInterval(function(){

window.opener.postMessage("work", "*");

},500);

</script>



I need detect if chiel.php not send "work" to parent.php, for example:



Thanks you so much









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

C# - How to create a semi transparent or blurred backcolor on windows form

Will Oldham

Makefile test if variable is not empty