I'm trying to access a global var (timer) on a webpage using the content.js script via my google chrome extension. However, everytime it returns undefined, even though I can easily access it via the developer console.
var mySocket;
console.log('content.js');
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
switch(request.task){
case "socketInjection":
window.setTimeout(
function(){ console.log(timer);}, 5000);
break;
}
});
Im using a setTimeout routine there, to make sure the page has loaded completely (which it should've anyways).
Anyone has a solution? Thanks in advance, Daniel