Closing Colorbox from iframe - calling parent doesn't work
I have a very simple colorbox call -
main page
- <html>
- <head>
- <link rel="stylesheet" href="colorbox.css" />
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
- <script src="../jquery.colorbox.js"></script>
- <script>
- $(document).ready(function(){
- $("#click").colorbox({width:"60%",
- height:"60%",
- iframe:true
- }); });
- </script>
- </head>
- <body>
- <p></p>
- <p></p>
- <a href="login.html" id="click">Click Me!</a>
- </body>
- </html>
Login.html
- <html>
- <head>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
- <script src="../jquery.colorbox.js"></script>
- <script>
-
- </script>
- </head>
-
- <body>
- <a href='#' onclick='parent.$.colorbox.close(); return false;'>close this iframe</a>
-
- </body>
- </html>
Whenever I click on the hyperlink, I get these two errors...
Uncaught TypeError: Cannot read property 'colorbox' of undefined
I understand the unsafe operation error but the second one is puzzling. This example is from jack Moore's site itself so it must be working for many people. Can someone point to me what mistake I'm making here. Thanks!