diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2014-07-13 12:08:12 -0400 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2014-07-13 12:08:12 -0400 |
| commit | 9488cab6fe509913b9d4819804a104e1371ffcc3 (patch) | |
| tree | 763427507e6b5cf0519dcc5bc636e0c4c508d841 /firefox-addon | |
| parent | 839b1245a2137fc3c4474b4ed8d04590b4245611 (diff) | |
| download | browsing-activity-tracker-9488cab6fe509913b9d4819804a104e1371ffcc3.tar.gz | |
Send data as JSON instead of x-www-form-urlencoded
Diffstat (limited to 'firefox-addon')
| -rw-r--r-- | firefox-addon/lib/main.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/firefox-addon/lib/main.js b/firefox-addon/lib/main.js index cc8845e..5814792 100644 --- a/firefox-addon/lib/main.js +++ b/firefox-addon/lib/main.js @@ -5,12 +5,12 @@ var prefs = require("sdk/simple-prefs").prefs; var XMLHttpRequest = require("sdk/net/xhr").XMLHttpRequest; function log(url, title){ + var data = JSON.stringify({ + url: url, time: Date.now(), + title: title, key: prefs.key + }); var xhr = new XMLHttpRequest(); - xhr.open("POST", prefs.callbackUrl); - var data = "url=" + encodeURIComponent(url); - data += "&time=" + Date.now(); - data += "&title=" + encodeURIComponent(title); - data += "&key=" + encodeURIComponent(prefs.key); + xhr.open("POST", prefs.callback); xhr.send(data); } @@ -18,7 +18,7 @@ function logTab(tab) { if (tab.id === tabs.activeTab.id) { log(tab.url, tab.title); } -}; +} tabs.on("activate", function () { logTab(tabs.activeTab) }); tabs.on("pageshow", logTab ); |
