Cannot read property 'onPageChanged' of undefined

Posted by user3522749 on Stack Overflow See other posts from Stack Overflow or by user3522749
Published on 2014-08-20T16:17:00Z Indexed on 2014/08/20 16:20 UTC
Read the original article Hit count: 363

sample extension background.js code

chrome.runtime.onInstalled.addListener(function() {
  chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
    chrome.declarativeContent.onPageChanged.addRules([{
      conditions: [
        // When a page contains a <video> tag...
        new chrome.declarativeContent.PageStateMatcher({
          pageUrl: { hostEquals: 'www.youtube.com'}
        })
      ],
      // ... show the page action.
      actions: [new chrome.declarativeContent.ShowPageAction() ]
    }]);
  });

});

and I got Cannot read property 'onPageChanged' of undefined in console. No problem running the code, why is that happening?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about google-chrome