Within my chrome extension's content scripts, I have implemented a dynamic loading mechanism for an external JavaScript file onto an HTML page once it has finished loading. This JavaScript file is responsible for defining a variable called rfk
. I have set up an interval to check for the existence of rfk
and execute a script once it is defined. However, even after confirming the presence of rfk
in the browser console, my content script fails to recognize its definition.
"content_scripts": [
{
"matches": ["*://www.att.com/*"],
"js": ["att.js"],
"run_at":"document_end"
}
]
Here is a snippet of the code from my att.js file:
alert('hey!');
document.body.style.backgroundColor="red";
var url="//product.reflektion.com/rfk/js/11165-52846072/init.js?cv=test&q="+(new Date).getTime()
, o = document, s = o.createElement("script");
s.type="text/javascript";
s.src=url;
o.getElementsByTagName("head")[0].appendChild(s);
var cE = setInterval(function(){
rfk && (demo="instagram",rfk.P.fs.rw.extra_args={drsp:{_v:demo}},rfk.rebuild(),clearInterval(cE))
},100);