I'm trying to include gmail.js from here.
But the object gmsrc
is invalid, the function get.user_email()
fails.
I'm trying to develop a Chrome extention, the chrome developer tools (F12) tells me
Uncaught TypeError: Cannot read property 'user_email' of undefined
Here is my code:
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js";
document.getElementsByTagName('body')[0].appendChild(jq);
var gmsrc = document.createElement('script');
gmsrc.src = "https://rawgit.com/KartikTalwar/gmail.js/master/src/gmail.js";
document.getElementsByTagName('body')[0].appendChild(gmsrc);
console.log("Scripts loaded, Start playing ...");
var name = gmsrc.get.user_email();
alert(name);
Where is my mistake?
Update (still not working):
I tried this, but it doesnt work either:
var jq = document.createElement('script');
jq.src = chrome.extension.getURL("lib/jquery-2.1.1.min.js");
document.body.appendChild(jq)
//inject gmail.js
var gmsrc= document.createElement('script');
gmsrc.src = chrome.extension.getURL("lib/gmail.js");
document.body.appendChild(gmsrc);
var name = gmsrc.get.user_email();
alert(name);