New Chrome Extension - Kittenify

I had an hour to kill this morning before a day of meetings, so I built a new Chrome extension - Kittenify. While not exactly rocket science, it simply takes all the images in a page and replaces them with calls to placekitten.com. As an example:

Stupid, I know. ;) But it did answer one question I had about Chrome extensions. In the docs I saw, there is always an HTML page tied to the click event of icons in the browser UI. I wasn’t sure how to simply run random JavaScript code on the click event. Turns out it is rather simple.

First - specify a background JavaScript file and do not specify a default_popup for browser_action. Here’s my manifest.json:

Then simply add an onClicked event for the browserAction object. I didn’t even know this was possible. (See, this wasn’t a waste of time!)

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for Extend by Auth0. He focuses on serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA https://www.raymondcamden.com

Comments