Skip to content

Latest commit

 

History

History
187 lines (128 loc) · 12.6 KB

differences-between-desktop-and-android-extensions.md

File metadata and controls

187 lines (128 loc) · 12.6 KB
layout title permalink published topic tags contributors last_updated_by date
sidebar
Differences between desktop and Android extensions
/documentation/develop/differences-between-desktop-and-android-extensions/
true
Develop
Add-ons
Guide
Mobile
NeedsUpdate
WebExtensions
mdnwebdocs-bot
ExE-Boss
gokulakrishna
hellosct1
ramkumar.kr94
andrewtruongmoz
PikadudeNo1
rebloor
wbamberg
mdnwebdocs-bot
2019-03-18

{% capture page_hero_banner_content %}

Differences between desktop and Android extensions

{% capture note %}

Warning: The content of this article may be out of date. This page has last been updated before Firefox 54.

{% endcapture %} {% include modules/note.html content=note alert=true %}

Firefox for Android offers a subset of the WebExtensions APIs available to the desktop version of Firefox. Some of these differences are due to the nature of the Android environment and therefore the features Firefox can implement, others are where Firefox for Android does not yet offer all the desktop features. This article describes and explains these differences and looks at the impact they might have on your add-on development.

{% capture note %}

This summary is based on the features planned for Firefox version 54.

{% endcapture %} {% include modules/note.html content=note alert=false %}

A detailed list of the WebExtension APIs supported in Firefox for Android is provided on the Browser support for JavaScript APIs page and details of the supported manifest.json keys are provided on the manifest.json section page.

{% endcapture %} {% include modules/page-hero.html content=page_hero_banner_content %}

{% capture content_with_toc %}

User interface

Firefox for Android offers a streamlined version of the UI found in desktop Firefox, ensuring Firefox offers an enjoyable and engaging experience on mobile. Some of the differences relate to how the Android UI differs from the desktop UIs found in Linux, Mac OS, and Windows. For example, Android does not support a windowing environment, and devices do not usually include a physical keyboard, from which keyboard shortcuts can be issued. Other differences relate to optimizing usability on smaller mobile device screens.

As a result of the UI differences, extensions for Firefox for Android do not support the following APIs and manifest.json keys:

  • commands and the related commands manifest.json key, as Android tablets and smartphones do not usually have a physical keyboard from which ‘commands’ can be issued.
  • sidebarAction and the related sidebar_action manifest.json key, due to the limited screen real estate on Android devices sidebars, such as the browser history, are presented in full browser tabs. Where possible, you should move any sidebar content to tabs as well.
  • windows as there is only one Firefox on Android 'window', so it has no ability to open or otherwise manipulate additional browser windows.

Support for browserAction and the browser_action manifest.json key is under development. Firefox 55 will support default_title and default_popup of the manifest.json key browser_action, using default_title to add an item to the Firefox for Android menu, and the browserAction.onClicked() event will be available to listen for the menu item being tapped. Additionally, in Firefox 57 support for the browserAction.setTitle and browserAction.getTitle methods will be added.

Effect on your add-on UI

These differences impact the way you expose your add-on in the Firefox UI. The most common option, adding a button for your add-on to the Firefox toolbar with browserAction, is not available (at least until Firefox 55). Nor can you expose your add-on through a sidebar or context menu. You will, therefore, use an address bar button (through the manifest.json page_action key and pageAction API) remembering that by default this button is hidden and must be shown programmatically.

The features of pageAction are also reduced in Firefox for Android. The manifest.json key page_action enables you to define the button icon and a popup. You then have use of pageAction.show() and pageAction.hide() however, once ‘shown’, note that the address bar button is visible in all tabs (unlike the desktop behavior, where the button is shown only for a specified tab.) But you will still be able to hide the pageAction using pageAction.hide() on a specific tab (say, for example, you wish to hide your extension's page action icon in about:addons or about:memory tabs) And you can set a listener to pageAction.onClicked(). pageAction.setPopup() and pageAction.getPopup() are also available, so you can update the popup or create a popup once the add-on is running.

Also, in both pageAction and browserAction popup content is opened in a new tab and persists until the user manually closes the tab.

You can also manipulate tabs on Firefox for Android. The tabs API enables you to perform most of the actions you can on the desktop, the main exceptions are:

  • zoom features, Firefox for Android has one zoom level only, which the user can override with a pinch gesture on the page.
  • features related to selecting and moving tabs, again as these features are not supported on Android.
  • the ability to detect a tab's language or muted status.

Other UI related API and manifest.json key differences

There are some other UI features not supported, these are:

  • bookmarks, which means you cannot manipulate the user's bookmarks, although the user can do this themselves through the UI.
  • browsingData, which means you cannot offer users features to clear browser data such as history, downloads, passwords, and alike.
  • The chrome_url_overrides and chrome_settings_overrides manifest.json keys, which means you cannot add custom home and new tab pages.
  • contextMenus, which means you cannot add options to context menus.
  • history, which means you cannot search or manipulate the history of browsed pages.
  • omnibox and the related omnibox manifest.json key, which means you cannot provide custom address bar suggestions.
  • sessions, which means you cannot list and restore tabs that have been closed while the browser has been running.
  • The options_ui manifest.json key can be used only from Firefox for Android version 57 and above.

Developer tools for Firefox for Android are provided through remote debugging mechanisms over USB or Wi-Fi that connect to the WebIDE on a desktop. Therefore, Firefox for Android does not provide any built-in developer tools and its extensions do not support the APIs to extend the developer tools:

{% endcapture %} {% include modules/column-w-toc.html id="user-interface" content=content_with_toc %}

{% capture content %}

Native application interaction

You do not have the ability to interact with native applications as runtime.connectNative() and runtime.sendNativeMessage() are not available.

{% endcapture %} {% include modules/one-column.html id="native-application-interaction" content=content aside="" %}

{% capture content %}

Permissions

Permissions to use certain WebExtension APIs must be requested in the manifest.json file. On the desktop version of Firefox users are warned when an extension requests a permission and are given the option to deny the add-on that permission. However, on Firefox for Android permissions are granted automatically and the user isn’t given the option to deny them. It is currently planned to resolve this issue in Firefox 57.

{% endcapture %} {% include modules/one-column.html id="permissions" content=content aside="" %}

{% capture content %}

Other notes

{% capture note %}

At the time of writing there was an issue with storage.sync() and data is not synchronized with the user’s Firefox account from Firefox for Android. More details can be found in bug 1316442.

{% endcapture %} {% include modules/note.html content=note alert=false %}

{% endcapture %} {% include modules/one-column.html id="other-notes" content=content aside="" %}

{%- include page-meta-data.html -%}

{%- include up-next.html -%}