My site is https://myapp.example.
I want my content script to run on every page under https://myapp.example/chats/*, and monitor its DOM using MutationObserver.
  "content_scripts": [
    {
      "matches": [
        "https://myapp.example/chats/*"
      ],
      "js": [
        "chat.js"
      ],
    }
  ],
But the issue is that it only runs if I refresh the page when I'm on the chat url.
If I start on the home page and then navigate to a chat page, nothing happens.
What's the best way to solve this?
Should I set matches to https://myapp.example/* and update the content script based on events listened by the background.js? Isn't it an anti-pattern to the whole purpose of content_scripts?
 
    