window.onload = function() { if (window.jQuery) { // jQuery is loaded alert("Yeah!"); } else { location.reload(); } }