get url of page in background script

JavaScript
chrome.tabs.query({
  active: true,
  currentWindow: true
}, function(tabs) {
  var tab = tabs[0];
  var url = tab.url;
});
Source

Also in JavaScript: