I'm building a simple Chrome Extension to get the URL of each of the users browser pages when opened and send back to the server. I can currently get the URL to appear in an alert box, however my ajax is returning a blank value to my database. The alerts work fine though(?)
Any ideas/thoughts? See script below..
Popup.html:
<html>
<head>
<title>Facebook Connect For Chrome Extension</title>
<script type="text/javascript" src="index.js"></script>
</head>
<body>
<h1>Facebook Connect For Chrome Extension</h1>
<p><a target="_blank"href="https://www.facebook.com/dialog/oauth?client_id=MY-APP- ID&response_type=token&scope=email&redirect_uri=http://www.facebook.com">Facebook Connect</a></p>
</body>
</html>
UPDATED background.js:
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
if (changeInfo != undefined) {
var http = new XMLHttpRequest();
http.open("POST",
"http://ec2-52-89-93-50.us-west-2.compute.amazonaws.com/phpindex.php",
true);
sendme = changeInfo.url
http.send(sendme);
}
alert(sendme);
});
UPDATED manifest.json:
{ "name": "Example", "version": "1.0", "description": "Example"
"browser_action": {
"default_popup": "popup.html",
"default_icon":"icon.png"
},
"background": {
"scripts": ["background.js"]
},
"manifest_version":2,
"permissions": [
"tabs",
"http://*.facebook.com/*",
"http://MY_SERVER/*",
"http://*/*",
"https://*/*",
"<all_urls>"
]
}