i have a page in html contains iframe.if message comes from iframe i have to handle it.but how to check if message event handler exist or not my code is
$(window).on('message',function(e){
console.log(e.originalEvent.data);
});
when button is clicked this code set message event handler.but when again clicked again message handler get added .Is there any method to know if in window object is message event handler present or not.Please guideline.i can't use global variable in my case.if its possible to get event handler from window object then please explain the method.
Try
jsfiddle http://jsfiddle.net/guest271314/9xC27/