简体   繁体   中英

Chrome extension closes when I click on the page

As stated in the title, the Chrome extension I've been developing closes whenever I click on the page, and I noticed that this happens with all the other extensions that I have.

I really have 2 doubts:

  1. Whether it is actually possible to leave the extension open regardless of whether the user clicks the screen or not;

  2. If it is possible to force the extension to open via Content_Script;

I presume by "extension closes" you mean that a popup in your extension closes.

This is indeed normal behavior that you cannot override if you click away.

It's also not possible to open a popup from your code in Chrome.

So if you need some UI that co-exists with a page you interact with, you'd need to inject it into the page itself. Probably using Shadow DOM so that the page's styling doesn't interfere with yours.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM