Development of Firefox browser extensions

Source: Internet
Author: User

Recently, some of Ali's programmers because of the use of their own JS script to carry out the internal operation of the moon cakes, led to some people maliciously classified as unfair competition, and eventually dismissed.
As for the causal relationship, I am not care, but I think the script is also the embodiment of the ability.
Back to the matter, through this incident, as well as the coming migratory ape journey, to quickly learn to write a ticket to the plug-in, otherwise there is no way to go home for the new year.
As an open source believer, Firefox is a must-have tool, so start by learning how to develop extensions for Firefox.

First, create a new webextenion directory, create a new Manifest.json file
This is the file is the browser read the resource file, inside the content is probably like this

{  "manifest_version": 2,  "name": "My firest Firefox plugin",  "version": "1.0" ,  " Description ":" The description of the plug-in, just write the point is good ",  " Icons ": {    " "": "Icons/border-48.png"  },   "content_scripts": [    {      "matches": ["*://*.crisen.org/*"],      "JS": ["Crisen.js"]    }  ]}

Several of these parameters should be specifically explained
Name of the plug-in
Versions of version plugins
Icons Plug-in icons
There are also content_scripts parameters
Where the matches parameter indicates that your plugin is in effect for the page, you can use regular expressions, if it is a grab ticket plugin, then you should fill in "matches": ["*://*.crisen.org/*"],
Then when you visit the ticket software, the browser will automatically load and parse the JS file set in the JS parameter
JS parameter is required to execute the JS script file, you can load multiple

Second, since the parameters are specified in the icon, then we must also have an icon to come over, but this step is not important, no icon to work
Create a new icons directory in the Webextenion directory, and then drag a picture to come in, named Border-48.png (same as the file name in configuration parameters)

Third, then is the JS file, since we specified in the parameters of the Crisen.js file (the new JS file specified in the Minefest.json), then directly create a text file, Then rename it to Crisen.js, in order to test, we write the following code in Crisen.js

Alert ("Welcome to Crisen ' s homepage")

Four, to this point, the preparation is finished, then enter about:debugging in the address bar of the Firefox browser, then click on the temporary loading add-ons, and then import the previously created Manifest.json can be

Then restart the browser, open the www.crisen.org can see the pop-up window, open Firefox add build can also see the written extension


Five, and then is to write JS code, as long as JS can solve the problem, it is not a problem, do not say, I still continue to write plug-ins, go home (@_@)

Development of Firefox browser extensions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.