"content_scripts" does not respond when page changes

Asked 1 years ago, Updated 1 years ago, 67 views

I'm creating extensions for YouTube, and I wrote the following in manifest:

"content_scripts":[
    {
        "matches": [
            "https://www.youtube.com/*"
        ],
        "js": [
            "content_script.js"
        ]
    }
],

When I opened the youtube.com page, it responded, but it didn't respond when I clicked on the video and changed to www.youtube.com/watch?v=_somePath.
How can I detect changes?

Tried:
I flew to www.youtube.com/watch?v=_somePath from the beginning and it responded.
For this reason, if I click on a video on YouTube, is it just drawing a video from somewhere?

The possibility is to fill in a program that automatically detects changes in the path from script and "content_scripts" can only be ignited once, but I couldn't do it because I wasn't good enough.

I have a question because I didn't understand even after I looked it up.
I would appreciate it if you could let me know.

javascript html google-chrome chrome-extension youtube

2022-09-30 10:42

1 Answers

I will close the question as it has probably been resolved.

Using "background_scripts" to pick up chrome.tabs.onUpdated from chrome api and send it to context seems to be the shortest way.It will take some time, but I would like to try it.


2022-09-30 10:42

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.