I'm creating a new Chrome Extension. And I have a content.js
file that looks like:
console.log('here');
I have a manifest.json
file that looks like:
{
"manifest_version": 2,
"name": "Netflix Binge Enabler",
"version": "0.1",
"permissions": [
"webNavigation"
],
"background": {
"scripts": ["eventPage.js"],
},
"content_scripts": [
{
"matches": [
"http://www.netflix.com/*"
],
"js": ["jquery-2.1.3.min.js", "content.js"]
}
]
}
eventPage.js:
console.log('here2');
chrome.webNavigation.onHistoryStateUpdated.addListener(function (details) {
console.log('Page uses History API');
});
When I go the netflix.com
I get the appropriate 'here'
string to show up in the console, but once I navigate to a movie/TV show, I don't get a second 'here'
even though the URL changes.
UPDATED: When I try to add a listener to the onHistoryStateUpdated
event, nothing triggers when I change pages. The initial console.log('here2')
doesn't fire at all so it seems like the background page isn't working properly. Might need to send an event from the content.js page or something?
Thanks!