What is the best way to show a sidebar/popup window on a context menu item click?

前端 未结 2 1792
予麋鹿
予麋鹿 2021-01-25 23:50

Problem

I want to show a popup window or a sidebar window on webpages when the user clicks on a Context Menu item(which I create through my extension ba

2条回答
  •  后悔当初
    2021-01-26 00:18

    You can either use option 1b (using sidebar.js as content script) or option 2(using iframe).

    But I would prefer option 2 because :

    1. You wont have to bootstrap your angular app every time you inject your frame if you are using angularjs.
    2. Your css files in iframe wont conflict with page UI .See my question : Using bootstrap.css as content script distorts gmail UI?
    3. You can put your entire application code inside iframe and use content script to inject frame and listen for messages only. You code would be easy to maintain and debug.

提交回复
热议问题