<commit_before>---
layout: default-withsidebar
title: Architecture Overview
author: shwetankdixit
copyright: opera-ccby
---
Let's delve deeper into the architecture and technical details of extensions in Opera. 

## The NEX Format
Opera supports the *NEX* file format for extensions. All the files and folders for an extensions are packaged into a zip file and renamed as *.NEX*. The NEX format will support a major portion of Chromium extensions as well as a few APIs specific to Opera. We've created a [list which details which APIs we support](tut_architecture_overview.html#apis_supported) from the Chromium project, as well as which ones are exclusive to Opera.

The APIs from the Chromium project supported in NEX extensions (like tabs) can be called using *chrome.\**, whereas the ones specific to Opera (like speed dials) will reside under the *opr.\** object. 

It is important to note that Opera will run extensions in the CRX format too, as long as the extension uses any of the particular chrome.* APIs which Opera also supports. So if you would like to just make an extension in CRX format and have it run in Opera as well, please make sure the APIs it uses are all supported by Opera.  

## Types of extensions

Currently, there are four types of extensions in Opera.

#### 1. Extensions involving Browser Actions (and Page actions)
You can use Browser Actions or Page Actions to put UI elements in the browser window. Browser Actions are used to put UI elements in the top right side of the browser *next* to the address bar. This is different from Page Actions which are used to place a UI element *inside* the address bar. 

Page actions are used to put a UI element specific to just a page or a limited set of pages fitting a certain criteria. If you would like the UI element to be there for all pages, then you should use Browser Actions for that purpose. The UI elements you can use are buttons, badges and popups. To know more on how to create and use these in extensions, please read the article on [creating buttons, badges and popups](tut_browser_actions.html). 

#### 2. Context Menu extensions
As the name implies, they are extenions to the context menu of the page. You can bring up the context menu by either right-clicking an element in the page, or by using the appropriate shortcuts using your keyboard (varies according to your platform). We've created an article on [how to create context menu extensions](tut_context_menus.html). 

#### 3. Speed Dial extensions
You can also create extensions on the Speed Dial in Opera. Keep in mind that to create Speed Dial extensions, you need to use the *opr* object, and will only run in an NEX file extension. Go ahead and check out [how to create Speed Dial extensions](tut_speeddial.html).
#### 4. Extensions with no UI
You can also create extensions which don't have any UI component. If you are familiar with injected scripts in previous (presto based) versions of Opera, or with greasemonkey scripts, then you get the idea. 

An example of this could be an extension which listens to certain keyboard inputs, and performs an action (like opening a certain page in a new tab) when that keybaord shortcut is typed by the user. These extensions will work as part of the content script, which will be discussed (along with others parts of an extension) in the next part of this article.

## Different parts of an extension

#### The Extension manifest 
Every extension *must* contain a manifest file. The manifest file provides basic information like the name of the extension and the author, etc, as well as some important information like the APIs the extensions wants to access, which is listed in the *permissions* field. If the extension manifest is not correctly defined, then there are chances that the extension will not run at all. Another important thing to note is the *developer* field, with which you can state the author's name in the manifest. 

To know more about the extension manifest, [read the API doc](manifest.html) on it. 
<commit_msg>Including the caveats in the architecture article itself<commit_after>---
layout: default-withsidebar
title: Architecture Overview
author: shwetankdixit
copyright: opera-ccby
---
Let's delve deeper into the architecture and technical details of extensions in Opera. 

## The NEX Format
Opera supports the *NEX* file format for extensions. All the files and folders for an extensions are packaged into a zip file and renamed as *.NEX*. The NEX format will support a major portion of Chromium extensions as well as a few APIs specific to Opera. We've created a [list which details which APIs we support](tut_architecture_overview.html#apis_supported) from the Chromium project, as well as which ones are exclusive to Opera.

The APIs from the Chromium project supported in NEX extensions (like tabs) can be called using *chrome.\**, whereas the ones specific to Opera (like speed dials) will reside under the *opr.\** object. 

It is important to note that Opera will run extensions in the CRX format too, as long as the extension uses any of the particular chrome.* APIs which Opera also supports. So if you would like to just make an extension in CRX format and have it run in Opera as well, please make sure the APIs it uses are all supported by Opera.  

## Types of extensions

Currently, there are four types of extensions in Opera.

#### 1. Extensions involving Browser Actions (and Page actions)
You can use Browser Actions or Page Actions to put UI elements in the browser window. Browser Actions are used to put UI elements in the top right side of the browser *next* to the address bar. This is different from Page Actions which are used to place a UI element *inside* the address bar. 

Page actions are used to put a UI element specific to just a page or a limited set of pages fitting a certain criteria. If you would like the UI element to be there for all pages, then you should use Browser Actions for that purpose. The UI elements you can use are buttons, badges and popups. To know more on how to create and use these in extensions, please read the article on [creating buttons, badges and popups](tut_browser_actions.html). 

Note: There can only be a maximum of 6 extensions installed at a time in the toolbar using browser actions, and only upto 4 which are based on page actions.

#### 2. Context Menu extensions
As the name implies, they are extenions to the context menu of the page. You can bring up the context menu by either right-clicking an element in the page, or by using the appropriate shortcuts using your keyboard (varies according to your platform). We've created an article on [how to create context menu extensions](tut_context_menus.html). 

#### 3. Speed Dial extensions
You can also create extensions on the Speed Dial in Opera. Keep in mind that to create Speed Dial extensions, you need to use the *opr* object, and will only run in an NEX file extension. Go ahead and check out [how to create Speed Dial extensions](tut_speeddial.html).
#### 4. Extensions with no UI
You can also create extensions which don't have any UI component. If you are familiar with injected scripts in previous (presto based) versions of Opera, or with greasemonkey scripts, then you get the idea. 

An example of this could be an extension which listens to certain keyboard inputs, and performs an action (like opening a certain page in a new tab) when that keybaord shortcut is typed by the user. These extensions will work as part of the content script, which will be discussed (along with others parts of an extension) in the next part of this article.

## Different parts of an extension

#### The Extension manifest 
Every extension *must* contain a manifest file. The manifest file provides basic information like the name of the extension and the author, etc, as well as some important information like the APIs the extensions wants to access, which is listed in the *permissions* field. If the extension manifest is not correctly defined, then there are chances that the extension will not run at all. Another important thing to note is the *developer* field, with which you can state the author's name in the manifest. 

To know more about the extension manifest, [read the API doc](manifest.html) on it. 

{'fraction_non_alphanumeric': 0.042447696214778084, 'fraction_numerical': 0.0012093360744951022, 'mean_word_length': 4.37012987012987, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3369773', 'n_tokens_mistral': 2016, 'n_tokens_neox': 1904, 'n_words': 1361}