我正在开发一个 Chrome 扩展程序并在弹出页面上嵌入了一个 Flash IRC 客户端。问题是,当弹出窗口被隐藏并在弹出窗口打开时重新启动时,它不会保持活动状态。有没有办法让那个元素保持活跃?
1 回答
It doesn't have anything to do with using a Flash object, but with the way popups work in Chrome Extensions. The page in a popup (typically popup.html
) doesn't exist at all when the popup is closed, so your Flash object doesn't "live" anywhere. So basically, the popup isn't just "hidden", it's closed and stops running.
Sadly the documentation is not explicit about that.
As far as I know, only the background page continues running at all times. If you were able to communicate through JavaScript with the Flash object, you might be able to have the background page run the Flash and store the messages, and whenever the popup is open, the popup page and the background page could use message passing so that the popup can display the messages that happened while it was closed. But that doesn't sound great.
Another alternative would be to open a popup window like we used to in the old days. :)