Robeezy
Robeezy

Reputation: 2464

Is chrome.extension.onRequest deprecated?

I'm building a chrome extension and attempting to attach an event listener to this, but I'm not seeing anything in the console of the background page.

chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
          console.log('REFERRER', request.ref);
        });

This code is in my main.js background page, all my other event listeners (chrome.tabs.onUpdated, chrome.extension.onMessage, etc) are all working fine though.

Upvotes: 6

Views: 14560

Answers (1)

Stan
Stan

Reputation: 8768

Yes, Request was deprecated in favor of 'Message'. So instead of onRequest you should use onMessage, and sendMessage as a replacement for sendRequest.

Upvotes: 14

Related Questions