Injecting jQuery into a web site

Posted by

This is really useful if you need to hack around with a site that doesn’t use jQuery. In my case, the web interface of a crappy Chinese IP camera which did its recording scheduling by making you click every 15 minute block in the week that you want to record.

Full credit should be given to

Code which you can put into your browser’s debugging console is as follows:

(function getScript(url){
    var script=document.createElement('script');

    var head=document.getElementsByTagName('head')[0],

    // Attach handlers for all browsers
    script.onload=script.onreadystatechange = function() {
        if ( !done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete') ) {

            script.onload = script.onreadystatechange = null;


Leave a Reply

Your email address will not be published.