I'm trying to fetch my chrome extension version, using the following code:
function getVersion(callback) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', 'manifest.json');
xmlhttp.onload = function (e) {
var manifest = JSON.parse(xmlhttp.responseText);
callback(manifest.version);
}
xmlhttp.send(null);
}
getVersion(function (ver) { console.log(ver); });
Problem is, HTTP request is sent to the site I'm injecting the script into, and obviously it fails.
For instance when my script is injecting into http://prodgame19.lordofultima.com/189, the HTTP request is sent to http://prodgame19.lordofultima.com/189/manifest.json.
What am I doing wrong?
Thanks.