For some reason the injected script will not get what the content script is sending it.
document.dispatchEvent(new CustomEvent('ToFBScript',{detail: {data: "Hello World"}}));
//Injecting Script
var s = document.createElement('script');
s.src = chrome.extension.getURL('fbscriptforextension.js');
(document.head||document.documentElement).appendChild(s);
s.onload = function(){
s.parentNode.removeChild(s);
};
My contentScript
var storage;
document.addEventListener('ToFBScript',function(e){
storage = e.detail.data;
console.log(storage);
});
My Injected Script