I am trying to use History.pushState() to change the URL of the Youtube results page (typed in an input into the search box in youtube home page and clicking search). It is not showing, and I cannot figure out why.
Here is what I have so far (I'm sending message to another script, but thats not very important to this problem):
if (window.location.href.includes('/results')) {
history.pushState({id: 'results'}, '', 'searchedVideos');
chrome.runtime.sendMessage({message: 'results'});
}
An answer to this will be extremely helpful. Thank you!
Edit: This is my manifest.json:
{
"matches": ["*://www.youtube.com/results*"],
"css": ["results.css"],
"js": ["content.js"],
"run_at": "document_idle"
},
{
"matches": ["https://www.youtube.com/"],
"css": ["home.css"],
"js": ["content.js"],
"run_at": "document_idle"
},
{
"css": ["videoRec.css"],
"matches": ["https://www.youtube.com/watch*"],
"run_at": "document_idle"
}