chrome.browserAction.onClicked.addListener(function() {
	chrome.tabs.create({
		'url': 'https://www.opera.com'
chrome.browserAction.onClicked.addListener(function() {
	chrome.tabs.query({
		currentWindow: true,
		active: true
	}, function(tab) {
		chrome.tabs.create({
			'url': 'http://wave.webaim.org/report?url=' + tab[0].url
chrome.browserAction.onClicked.addListener(function() {
	chrome.tabs.query({
		'currentWindow': true,
		'url': pattern
	// This will match all tabs to the pattern we specified
	}, function(tab) {
		// Go through all tabs that match the URL pattern
		for (var i = 0; i < tab.length; i++){
			// Update those tabs to point to the new URL,
			// which is the Opera homepage
			chrome.tabs.update(
				tab[i].id, {
					'url': 'https://www.opera.com'

To close, reload and duplicate tabs, you need to use the remove()reload() and duplicate() methods respectively. The important thing to note about these methods is that you do not necessarily need to mention the tabs permission in the extension manifest in order to use them in the extension.

All three of these methods work in the same way. Let’s look at some example extension code that reloads a tab. The first thing to do would be to get hold of the current tab, after which you would call the reload() method. So, in the background script you would write something like so:

chrome.tabs.query({
	currentWindow: true,
	active: true
// Get the current tab
}, function(tab){
	// Remove the tab
	chrome.tabs.remove(tab[0].id);
chrome.browserAction.onClicked.addListener(function() {
	chrome.windows.create({
		'url': url_list,
		'incognito': true
	
  • Working With Tabs and Windows
  • Working with the context menu
  • Creating Extensions For The Sidebar
  • Working With Bookmarks
  • Creating Address Bar Extensions
  • OTHER CONCEPTS
  • Passing Messages in Extensions
  • Content Scripts
  • Match Patterns
  • Permissions Declarations
  • Optional Permissions
  • BROWSER FEATURES
  • Adding keyboard shortcuts
  • Working With Downloads
  • Working With the Browser History
  • Removing Browsing Data
  • ADVANCED CONCEPTS
  • Controlling Privacy Features
  • Using webNavigation
  • Site-specific Customization
  • Extending DevTools
  • FINAL STEPS AND SAMPLES
  • Internationalization
  • Testing and Debugging
  • Creating Effective Icons
  • OPERA ADDONS STORE
  • Publishing Guidelines
  • Acceptance Criteria
  • API DOCS
  • Extension APIs Supported in Opera
  • Opera Add-ons API
  • Opera Sidebar Action API
  • Manifest Files
  • chrome.bookmarks.getRootByName
  •