Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

109
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda