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

107
Views
Run content script when URL Subdirectories Change for Chrome Extension

I have a Google Chrome extension that will parse parts of a Google Mail email for the sender's email address and validate it based on an email API. The extension is up and running however, the content.js script will only work when I refresh the page after opening an email. I have my manifest.json set to match on https://mail.google.com/* and I want it to run every time the subdirectory changes.

Basically, I want to be able to run the content script every time the URL changes from https://mail.google.com/mail/u/0/#inbox/FMfcgzGpFWLJXXbptnzzBMFCmMqFVTsz

to

https://mail.google.com/mail/u/0/#inbox/FMfcgzGmvpHMHxJwNhRgHdFNMHTDKnNq

How would I enable my content.js to detect whenever the URLs subdirectory is changed?

Also would it be better to change my manifest.json set to match https://mail.google.com/mail/u/0/#inbox/* instead of https://mail.google.com/*

content.js

window.addEventListener('load', function () {
    /* Logic to parse email */
}
manifest.json

"content_scripts": [{
    "matches": ["https://mail.google.com/*"],
    "js":      ["jQuery.js", "content.js"]
}],

"permissions": ["tabs", "https://*/"]
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!