webextensions-examples | Example Firefox add-ons created using the WebExtensions API | Addon library

 by   mdn JavaScript Version: Current License: MPL-2.0

kandi X-RAY | webextensions-examples Summary

kandi X-RAY | webextensions-examples Summary

webextensions-examples is a JavaScript library typically used in Plugin, Addon applications. webextensions-examples has no bugs, it has no vulnerabilities, it has a Weak Copyleft License and it has medium support. You can download it from GitHub.

Example Firefox add-ons created using the WebExtensions API

            kandi-support Support

              webextensions-examples has a medium active ecosystem.
              It has 3670 star(s) with 2602 fork(s). There are 163 watchers for this library.
              It had no major release in the last 6 months.
              There are 49 open issues and 182 have been closed. On average issues are closed in 203 days. There are 10 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of webextensions-examples is current.

            kandi-Quality Quality

              webextensions-examples has 0 bugs and 0 code smells.

            kandi-Security Security

              webextensions-examples has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              webextensions-examples code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              webextensions-examples is licensed under the MPL-2.0 License. This license is Weak Copyleft.
              Weak Copyleft licenses have some restrictions, but you can use them in commercial projects.

            kandi-Reuse Reuse

              webextensions-examples releases are not available. You will need to build from source code and install.
              webextensions-examples saves you 550 person hours of effort in developing the same functionality from scratch.
              It has 1289 lines of code, 6 functions and 182 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed webextensions-examples and discovered the below as its top functions. This is intended to give you an instant insight into webextensions-examples implemented functionality, and help decide if they suit your requirements.
            • Display a note display
            • Listen for events on the page
            • Remove data from stored time .
            • Replace all text nodes with text content inside a node .
            • Creates suggestions from suggestions .
            • Process permission change
            • Show the cookie in the list of available cookies
            • Finds results in the current tab
            • Detects if accessKey is supported in the browser .
            • Render element descriptions
            Get all kandi verified functions for this library.

            webextensions-examples Key Features

            No Key Features are available at this moment for webextensions-examples.

            webextensions-examples Examples and Code Snippets

            No Code Snippets are available at this moment for webextensions-examples.

            Community Discussions


            Getting `Uncaught (in promise) Error: Missing host permission for the tab` in background script of firefox extension
            Asked 2021-Dec-30 at 08:00

            Here is my background script;



            Answered 2021-Dec-30 at 08:00

            activeTab works only when the user explicitly invokes your extension as described in the documentation for WebExtensions and Chrome extensions). Evidently, its name is highly misleading: it should have been something like activeTabWhenInvoked.

            In order to access any tab without prior interaction with your extension you'll have to add broad host permissions in manifest.json:

            Source https://stackoverflow.com/questions/70527776


            Firefox extension how to get extension storage value
            Asked 2021-May-31 at 07:30

            I created a temporary Firefox add-on which opens a new tab when an icon is clicked. I used the example provided in this link:


            This works fine but the new tab opens to a fixed URL. So added a preferences page using the code provided in this link:


            Now I'm able to save a URL in the preference page of the extension and the saved URL can be verified in the Extension Storage, here is an image showing it:



            Answered 2021-May-31 at 07:30

            Since you have the onGot(item) function working. You should give your preference_url a name to be traced from.

            As you can see, when you inspect the [ Extension Storage ]. The preference_url is stored in a key named as type.

            So, you should give it a name like preferred_URL or other name for easy tracking.

            Source https://stackoverflow.com/questions/67763573


            WebExtension onBeforeReuest is not trigger for request from fetch API
            Asked 2021-Mar-01 at 08:49

            New to web extension development & I'm trying this example. However when I run this extension it does not trigger the listener.

            This is the manifest file.



            Answered 2021-Mar-01 at 08:49

            Quoting MDN:

            To intercept resources loaded by a page (such as images, scripts, or stylesheets), the extension must have the host permission for the resource as well as for the main page requesting the resource.

            So, you also need to add in manifest.json because it's not the same as localhost, which can actually point to a different IP.

            Source https://stackoverflow.com/questions/66417496


            Replace Thumbnails and Theme Switching
            Asked 2020-Dec-08 at 19:01

            I am currently making an extension, and I hope I could get some practical advice on feasibility :

            I want my extension to go fetch/load a local folder of custom homescreen thumbnails(top-sites), and then replace the auto-generated thumbnails in the homescreen with those it loaded. The extension would be able to read the associated domain names of the thumbnails and then replace them accordingly.

            (e.g :Pinned Url : youtube.com/anything : Ok so it’s YouTube : then replace the thumbnail with “Custom_Youtube_Thumbnail.png”)

            Does that seems possible to you ? (Before I dive in head first) I saw that the top-sites API is not quite available https://bugzilla.mozilla.org/show_bug.cgi?id=1246693 but maybe I’m wrong.

            Extra : My extension is switching themes (like this : https://github.com/mdn/webextensions-examples/tree/master/theme-switcher ). Would it be possible to switch the thumbnails accordingly (Custom_Youtube_Thumbnail_light.png > Custom_Youtube_Thumbnail_dark.png) as i’ve made a version for each.

            Would be a pleasure to hear your opinion on this, or just pointing useful resources to me, I’m not asking for a perfectly baked solution. Hope I’ve been concise.

            Thanks for reading me !



            Answered 2020-Dec-08 at 19:01

            Very nice idea you had. But In short: no possible.

            Main problem is that you cannot inject and manipulate on the homepage which is a built in browser tab.

            "You cannot inject code into any of the browser's built-in pages, such as: about:debugging, about:addons, or the page that opens when you open a new empty tab." https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/executeScript

            Source https://stackoverflow.com/questions/65185315


            Encounter encoding problem while copying an email from Thunderbird via Delphi using native messaging
            Asked 2020-Oct-28 at 16:11

            I'm writing a plugin in thunderbird using native messaging (following the ping pong example in python) to call a Delphi program to copy an e-mail locally as an ".eml" file. The problem I am facing seems to be the encoding. In addition, the resulting file contains double quotes ("") at the start and the end of the file as well as escaped double quotes (\"). I just want to have a 1 to 1 copy and not to change its content.

            Example of a mail content:



            Answered 2020-Oct-28 at 16:11

            At first let me say that you did a good job in transferring data between web extension (Thunderbird add-on) and native application using native messaging. It isn't easy to understand it and set it up, but you managed to transfer required data with some tiny glitches you describe in your question.

            ... the resulting file contains double quotes (") at the start and the end of the file as well as escaped double quotes (\")

            In the add-on you obtain raw email data as a string - console.log(typeof raw) gives string which you then pass to port.postMessage. Although the documentation says it takes JSON object representing the message to send, but it seems to accept single string value which is valid JSON according to some standards. In Delphi code you receive the message via STDIN and parse it using TJSONObject.ParseJSONValue into TJSONValue. It will in fact create instance of TJSONString. You can verify that by examining the value of jsonValue.ClassName. The problem with quotes arises when you use jsonValue.ToString which returns quoted version of the string that is basically the same what you had before parsing. Use the Value property to return raw string value.

            Using jsonValue.Value alone will not help you with the encoding issue. The raw message data that you obtain from the e-mail client is in EML format. It conforms to RFC-822 and that means it is ASCII encoded, but it can contain arbitrarily encoded message parts (see your own sample EML). Since you only want to save EML file as is not taking any encoding into account, the best would be to transfer raw bytes of EML, but this isn't out-of-the-box supported by Javascript and native messaging API. Therefore I'd suggest you to send Base64-encoded data string to native application where you decode it into raw bytes that you can write straight to disk.

            To encode raw message data as Base64 string in add-on use function btoa:

            Source https://stackoverflow.com/questions/64558872

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install webextensions-examples

            You can download it from GitHub.


            These examples are tested in Firefox. They may work in other browsers, if the browser supports the APIs used. Note that these examples all use the browser namespace and promises to work with asynchronous functions. This means the examples won't work in Chrome unless you use the polyfill provided by Mozilla. See the overview of WebExtension APIs for more information.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone mdn/webextensions-examples

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link