Reference Your JavaScript in manifest.json

After the kittenbook extension is successfully installed, you are ready to make it actually do something. You already have a JavaScript file written, so all you need to do is make that JavaScript available on Facebook.com. We ran into this problem earlier when we tried to add the JavaScript file to kittenbook.html. To solve that problem, we had to tell kittenbook.html about the JavaScript file. In this case, we need to tell manifest.json about the JavaScript file. We also need to tell manifest.json the website to which our JavaScript file should be added. We can do this by using a property called content_scripts (see Listing 1.11). Content scripts are JavaScript files that should be added to the content ...

Get Learning to Program now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.