Skip to content
Advertisement

Why is my chrome Context Menu button not working when clicked?

New to extensions development here. I’m trying to build a simple extension where if the user highlights some text on the webpage and clicks on the defined context menu option then an alert message message is displayed. However, when the context menu option is clicked nothing happens. Not sure where I’m going wrong. Please help. Thanks!

Here is my code:

hello.js `

JavaScript

manifest.json `

JavaScript

Advertisement

Answer

I rewrote your program. I hope this works as you expected. Read the program comments carefully.

hello.js

JavaScript

alert.html

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement