0

My extension is supposed to work with https://web.whatsapp.com/:

  "content_scripts": [
    {
      "matches": ["https://web.whatsapp.com/"],
      "js": ["entry/content-script/cs.js"],
      "css": ["entry/content-script/zen-mode-ui.css"]
    }
  ],

When I load web.whatsapp.com directly, in a new tab - all is fine: the stylesheet is injected like it's supposed to: injected

But! If I first go to whatsapp.com and there click the link to Whatsapp Web - when web.whatsapp.com loads, the css is NOT injected: not injected
There is no injected stylesheet snippet. Although, the content script loads just fine.
If I then refresh the page - all is good.
Is it a bug in chrome extensions engine itself?

avalanche1
  • 3,154
  • 1
  • 31
  • 38
  • 1
    Add `*` and match all subdomains: `"matches": ["https://*.whatsapp.com/*"]`, [more info](https://stackoverflow.com/a/66633274). – wOxxOm Mar 15 '21 at 16:48
  • @wOxxOm, no this is not an SPA or a subdomain issue. I tried `"matches": ["https://*.whatsapp.com/"]` before posting the Q and it didn't work. But! changing it to `"matches": ["https://web.whatsapp.com/*"]` did work! Do you have any idea as to why?? – avalanche1 Mar 15 '21 at 16:55
  • Sounds like a bug alright. – wOxxOm Mar 15 '21 at 17:00

1 Answers1

0

Setting "matches": ["https://web.whatsapp.com/*"] (note the final asterisk) have fixed it.
Looks like a bug in Chrome. Track here.

avalanche1
  • 3,154
  • 1
  • 31
  • 38