I have an extension that loads Zepto into the page and uses it in the content script. e.g.
chrome.tabs.executeScript(tabId, {file: "lib/js/vendor/zepto.js", runAt: "document_start"});
chrome.tabs.executeScript(tabId, {code: content_script, runAt: "document_idle"});
Where 'content_script' looks something like ...
(function($) {
if ($) {
...
} else {
console.log("extension: Zepto not found");
}
})(window.Zepto||window.$);
The issue is the extension works intermittently, working fine for a while, then "Zepto not found" in the console, then working again? I getting this behaviour using document_end so tried document_start, but same results.
Any ideas on how to get this working consistently, gratefully received
Thanks P