Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

195
Views
React/Chrome extension - How to modify content of popup on URL change?

I'm learning Chrome extension development and want to update the content of my popup whenever theres change to the URL (Not a tab change!).

My content script is basically accessing the DOM and grabs some text to set as a name within Chrome localStorage. popup.js then retrieves the name from localStorage and outputs within the pop.up.

Problem: How can I re-run the content script whenever the current pages URL changes? I think I would need to use chrome.tabs.onUpdated.addListener but unsure of how to implement. How can I best implement this functionality?

So far I have the following:

contentScript.js

// Store name in localStorage
chrome.storage.local.set({ name });

popup.js

// Get name from localStorage and set as some state
useEffect(() => {
    chrome.storage.local.get('name', (data) => {
        setName(data.name);
    });
}, []);

manifest.json

"permissions": ["storage", "tabs"],
"content_scripts": [
    {
        "matches": ["https://site.storm.com/*"],
        "js": ["contentScript.js"]
    }
about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!