Having panel behavior in chrome extension

别说谁变了你拦得住时间么 提交于 2020-01-10 08:07:11

问题


I need to have panel behavior in chrome: something always on top but that does not impair the navigation (in any other way than masking a few pixels).

We have two options at the moment:

  • window in panel mode: not available yet (although it is available now to the GTalk extension).

  • window in popup mode: I can make it be always on top by refocusing at every event, however the focus will get targeted at my window (and impair the navigation)

I'm looking for either:

  • GTalk's dark magic

  • A way to make a popup window stay on top (or come on top and relinquish the focus to the second topmost window)


回答1:


I found how GTalk is the only extension with panels. You can have panels too in your own extension, using really dark magic:

In your manifest.json, add the key-value pair:

"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDsDApubb73tPfYlNIFxDu3K3/EHgV6/YOJXJkld1OZ20jW/cOht1j0NggnXhQYuu1mXFUufud4I2N7b5ydyg09gcM9Va3Zk17RhNV9smbPHOd4XlzJeXifX/9MgHPu4FzCen3CiSXsOeAELJIXEuT28xICriuUko/rNPwGeIB9VwIDAQAB"

And BOOM, panels activated!

This is Google's way of activating a hidden feature. The documentation tells us "key"'s purpose is to provide a unique identifier but that we don't really need it. As demonstrated, it also activates hidden features.

Also, you cannot have two extensions with the same "key" value (GTalk gets uninstalled). And I think your extension might not make it to the chrome store.

If you know someone at Google, please tell them we mortals would really really love to have panels too. Panels are awesome. And they are the only way to display information on top of a web page while still interacting with it. Google should share the love, we really need panels.



来源:https://stackoverflow.com/questions/9778098/having-panel-behavior-in-chrome-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!