Question: I use this code, but javascript is not loading.

```
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
var prefix = this.is_current_https ? "https://" : "http://";
script.type = 'text/javascript';
script.onload = fnCustomHandler;
script.src = prefix + 'apis.google.com/js/plusone.js';
head.appendChild(script);

```

not even listening to `script.onreadystatechange` is generating any output.

When I debug `console.log(script)` I see whole element created properly, but referenced script is not loaded.

I tried too `head.appendChild(script.cloneNode(true));`

**Notes**

* after document.onload
* in google chrome
* no errors in console

**Notes 2**

Discovered on @`john_doe` comment, **script code gets injected into page** (into html->head), **but not loaded** (as seen in Networking tab). What can cause this?

Answer: 
It says that it loads an object:

```
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
var prefix = this.is_current_https ? "https://" : "http://";
script.type = 'text/javascript';
script.onload = function () {
    alert('typeof window.gapi.plusone === ' + typeof window.gapi.plusone); // this
};
script.src = prefix + 'apis.google.com/js/plusone.js';
head.appendChild(script);

```
I tried it and the error is that `fnCustomHandler` is undefinded, if i take that line of it loads perfectly.

EDIT - i tried 

```
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
var prefix = this.is_current_https ? "https://" : "http://";
script.type = 'text/javascript';
script.onload = function(){
alert('hi');
};
script.src = prefix + 'apis.google.com/js/plusone.js';
head.appendChild(script);

```

and it works ok so there must be a problem in your function