I\'m writing a Chrome extension, I need to get my extension\'s id in my code, so I don\'t need to change it manually every time. How can I do this?
You can get it like this (no extra permissions required) in two different ways:
Using runtime api: var myid = chrome.runtime.id;
Using i18n api: var myid = chrome.i18n.getMessage("@@extension_id");
but you don't need it for opening pages, as chrome.tabs.create() (and some others) understand relative paths.
So to open index.html from your extension folder you should just use:
chrome.tabs.create({url: "index.html"});