Trigger from iframe to parent window
Hello. I have this structure:
Index.html:
- <html>
- <head>
- <script src="jquery-1.3.2.min.js"></script>
- <script>
- $(document).ready(function(){
- $('iframe').bind('myCustomTrigger', function() {
- alert('hello');
- });
- });
- </script>
- </head>
- <body>
- <iframe src="iframe_file.html" width="800px" height="600px">
- </iframe>
- </body>
- </html>
iframe_file.html:
- <html>
- <head>
- <script src="jquery-1.3.2.min.js"></script>
- <script>
- $(document).ready(function(){
- $('button_click').click(function() {
- $(document, parent.window.document).trigger('myCustomTrigger');
- });
- });
- </script>
- </head>
- <body>
- <br/>
- <br/>
- <input type="button" value="Click me" id="button_click">
- </body>
- </html>
This is does not work, how I can send trigger event from iframe to parent window?