I program user script and I have problem in Chrome (Firefox with Greasemonkey is OK): I use Tampermonkey; here is the code:
// Header...
(function addjQuery() {
var head = document.getElementsByTagName('head')[0] ;
var jQuery = document.createElement('script');
jQuery.type = 'text/javascript';
jQuery.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';
head.appendChild(jQuery);
waitjQuery() ;
})();
function waitjQuery(){
typeof jQuery == 'undefined' ? setTimeout(waitjQuery, 50) : main() ;
}
My script loop in function wait and the typeof jQuery
(or $...) is always undefined. I have checked head of page HTML with console and jQuery is correctly loaded...