I have a Google Chrome Extension that uses Fancybox ( http://fancybox.net/ ) to show a login form.
After a user logs in or registers I would like to automatically close the lightbox. The Fancybox is hosted locally in the Chrome Extension while the login form is on our domain.
Is there a way for the iFrame (our domain) to call a function to close the Fancybox?
Yes. You'll have to use cross-window messaging and postMessage. This allows your extension to post a message, and your iframe to receive it. You'll need code on both ends (to send and receive the message).
Here's a good tutorial (not chrome extension specific): http://javascript.info/tutorial/cross-window-messaging-with-postmessage
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.