Question: How to make a Chrome Extension run code when on a certain url

Question

How to make a Chrome Extension run code when on a certain url

Answers 1
Added at 2017-01-05 02:01
Tags
Question

I'm trying to build a Chrome Extension that needs to send a POST request to a server when the user is on a certain url/path.

I have that part working, except the code I have right now only runs when I click on the icon of my Chrome Extension, how would I make the code run every time I'm on a certain url?

I also need data stored in chrome.storage to be accessible in the code that runs every time aswell

Answers to

How to make a Chrome Extension run code when on a certain url

nr: #1 dodano: 2017-01-05 03:01

The answer is to use a content script

Specify the matching url in your manifest.

A background page is always running, but the content script is only injected on specific pages (you can specify before/after load end)

Source Show
◀ Wstecz