I’m building a Chrome Extension that features both a popup and a content file. I’m trying to load a SiteCatalyst s_code.js file in to the popup for anayltics purposes.
Loading the file via the standard tag in the index.html file doesn’t work. I’ve tried using the example here: how to load JS from a chrome extension popup – that uses the
chrome.runtime.getBackgroundPage(function callback) example like so:
In my index.html file:
In my popup.js file:
chrome.runtime.getBackgroundPage(trackingPage => trackingPage.testMethod());
And in my
const testMethod = () => console.log('s_code loaded');
I’ve also added the reference to the file in my
content_scripts (this file will be needed in both popup and content areas.