I am involved in the development of the Chrome extension.
At some point, we need to run some static, non-generated code that should run in the context of the page, not the extension.
For simple scripts, there is no problem using $.getScript(chrome.extension.getURL(....))
or script = document.createElement('script'); ... document.body.appendChild(script);
script = document.createElement('script'); ... document.body.appendChild(script);
For more complex scripts, we sometimes need to include jquery or another script definition (due to dependencies).
In this latter case, while Javascript is supposedly single-threaded, it seems that jQuery is not parsed completely when the script dependency is executed, resulting in the following
Uncaught ReferenceError: $ is not defined
Am I mistaken in assuming JScript is single-threaded? What is the correct way to enter scripts on a page if there are dependencies between these scripts? (e.g. script X uses the function defined in script Y)
source share