HTTP requests, JavaScript, Tabs, and Bookmarks

Pete Fison
12 min readJan 26, 2024
Photo by Rubaitul Azad on Unsplash

In Part 1 of this series I explained how to create your first Chrome Extension in Python, but we didn’t really create anything very exciting or interactive (unless datetime gets your pulse racing).

Part 2 is a much longer article and opens the doors to handling dynamic input and output from within your Chrome Extension, including:

  • Sending HTTP requests
  • Copying data to the clipboard to use outside of Chrome
  • Accessing JavaScript objects (functions and/or data) from Python
  • Interacting with Browser Tabs and Bookmarks

This article is also a stepping-stone to Part 3 (coming soon™) which finally answers the most common question I’ve been asked, namely “How can I interact with the DOM or change the HTML of the web page I’m viewing?”. It turns out that’s not so simple to achieve, and you’ll need to work patiently through this article for the next one to make sense… So let’s get cracking!

Anatomy of the Extension

You can follow along and see all the code use in this tutorial by forking or cloning the repository below:

--

--

Pete Fison

Experienced Python developer with a special interest in web scraping, data wrangling, ETL, NLP, and AI Prompt Engineering. Former IT Director & Video Producer.