Chrome webNavigation.onComplete not working? -


i'm trying write chrome extension executes code when user on youtube page video. far can tell, code correct, isn't working.

eventpage.js:

chrome.webnavigation.oncompleted.addlistener(function(){   console.log("test") },{url: [{pathcontains: "watch", hostsuffix: "youtube.com"}]}); 

and manifest file

{   "manifest_version": 2,    "name": "youtubeextension",   "description": "a chrome extension youtube",   "version": "0.1",    "permissions": ["https://www.youtube.com/", "webnavigation"],   "background": {     "scripts": ["eventpage.js"],     "persistant": false   } } 

it seems oncompleted doesn't work on youtube.

chrome.webnavigation.oncompleted triggered when document has finished loading. when navigate different page on youtube, new page not "loaded" in traditional way, page dynamically updated, , url replaced using history.pushstate. detect kind of "navigations", use chrome.webnavigation.onhistorystateupdated event in addition oncompleted event.

another way detect videos on youtube pages using content scripts on youtube , event specific youtube, see this answer.


Comments

Popular posts from this blog

c++ - OpenMP unpredictable overhead -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

javascript - Wordpress slider, not displayed 100% width -