accessing the current html page from chrome extension

You can use the tabs module:

chrome.tabs.getCurrent(function(tab) {
    alert(tab.title);
});

Content scripts are the easiest way to go:

Expand your manifest file with this code:

...
"content_scripts": [
  {
  "matches": ["http://urlhere/*"],
  "js": ["contentscript.js"]
  }
],
...

Content script (automatically executed on each page as mentioned at matches at the manifest file):

alert(document.title)

The advantage of using content scripts over chrome.extension.* methods is that your extension doesn't require scary permissions, such as tabs.


See also:
  • Developer's guide
  • Content scripts
  • Background pages