📜 ⬆️ ⬇️

Writing Extensions for Opera and Chrome: A Look at the Process


How many of you remember some time ago, Google for the second time hid the link to Reader, replacing it with a link to Photos. For the first time, this caused a wave of user dissatisfaction and Google returned everything, citing an error. Then, immediately, an extension for Chrome appeared, returning the link to Reader. I have ported this extension for Opera.

The second time Google moved the link, the wave of indignation was no longer so strong. At first it seemed to me that no one paid any attention. The community was busy with more important news. But there was a discussion on Google’s support forum and even an official response that Google always seeks to improve its products and such an improvement can lead to actions similar to what happened with a link to Reader. I remembered my extension, uncovered a dusty code, and decided to make the extension more pleasant and more meaningful. Namely - to give the user the opportunity to set the link structure himself. The extension should dynamically pull out all links from the page, show them to the user in the form of two columns and allow them to be dragged with the mouse. It turned out that for Chrome there was no such extension either, and additionally I wondered to write two extensions with common code.

Extensions Architecture


The architecture of extensions is similar in both browsers. It is conditionally possible to divide the internal part of the extension into what works in the context of the page being viewed and what works in the context of the browser. Why is it important to separate these concepts? Because for the scripts implemented on the page, there is a more stringent security policy. For example, I could not connect a third-party script. I have jQuery library as such a third-party script. At the same time, the script that works in the context of the browser, without any problems, connects anything. For more specificity, let's call scripts by their names: the background process works in the context of the browser, the built-in - in the context of the page.

The interaction between the background and the built-in scripts takes place through messages. You need to hang up message handlers there and there and go. Implementation details have already been covered on Habré.
')

Code


If we talk about the code, we can highlight several interesting points:


Technical documentation and related materials


The level of assistance to the developer Opera and Google differ slightly. Both companies provide detailed documentation, videos, examples. Subjectively, it's harder for me to read Google's documentation. They are very fond of hyper-links and reading turns into a leapfrog: read a paragraph, click on a link, read a paragraph, switch either on a new link, or back. A separate quest from Google: try to go to the documentation page and find recommendations for publishing an extension. Google is increasingly focused on applications, rather than extensions. Background information about the process for publication is on the application development pages .

The Opera did a great thing - templates for creating icons. Templates can be used in Photoshop or Inkscape. I am far from design and it took me some time to master this pattern, but then I appreciated it in its true worth. With it, it's really easier to create icons of the right size.

Chrome Web Store and Opera Extensions


OperaGoogle
Localization and description of the extensionInvites the developer to fill in the description in all localization languages, showing the input fields one by oneShows only one input field. Switching to another language is done using a combo box. I did not immediately find this combo box and thought that for some reason I can enter a description only in the language selected by default
ScreenshotsThere is only one size requirement - screenshots must be less than 800x600 pixelsThey offer to make screenshots of a fixed size of 1280x800 pixels. Additionally, they offer to make several advertising images. Expansions without advertising images receive less attention in search results.
Visibility extensionsThere is a section - new arrivals. Through it, people can at least somehow learn about updates or updates. I think that my expansion was noticed because of this section.There is no information about new extensions. The published extension immediately goes into the common boiler and is very difficult to find through the official catalog.


Google gradually teaches us to useless URL. Surely there are people who go on Facebook, stuffing facebook in the search and following the link. Why do we need an address to remember, if there is a Google that remembers everything for us? As a result, extensions in the Chrome catalog have excellent identifiers of the form jlmhhcdodlafcgaopokedcaejpbiagkk . Try reading the text and encountering two links. chrome.google.com/webstore/detail/jlmhhcdodlafcgaopokedcaejpbiagkk chrome.google.com/webstore/detail/jlmhhcdodlafcgaopokedcaejpbiagkk and chrome.google.com/webstore/detail/iiamfmleocemmjdnbfifnmdgekeokakh chrome.google.com/webstore/detail/iiamfmleocemmjdnbfifnmdgekeokakh , understand which link refers to which extension. Opera creates a link based on the name of the extension.

About people


People do not read already written comments before sending theirs. Actually, this is not news for any blogger, but nonetheless. Take the same thread on the Google forum. It is 99% percent of the messages "return back the link to the Reader." In this thread, I left a link to my extension. It seems no one noticed. Everyone continued to write angrily about the return of the link. Someone even released another such extension (just changing the links in some places) and also wrote about it in the thread. A small discovery was how one person really liked my extension, and he went and wrote about it all on the same Google forum and gave a link. His message, unlike mine, did not go unheeded.

In the Opera, several times people wrote that they rated 3 or 4 because of that and because of that, but they missed it with a mouse and actually put it 2. This is, firstly, the issue of usability. Perhaps such a rating on Habré (plus and minus) would be clearer. Secondly, you do not get a rating that would make your extension more visible to users. Thirdly, if you are prone to worry much about the rating, then your experience will increase.

Statistics


I was very surprised by the approach to statistics from the search giant. The developer is available a figure called "number of users per week." This figure tells me little. The fastened statistics of Google analytics helped to understand that they still use my extension in Chrome. Opera also shows an easily understandable figure - the number of downloads. With this figure I will not need additional statistics to understand the relevance of the expansion. But in both browsers I do not know anything about those who may have installed the extension for themselves, and then deleted it. So, in general, I would like more informative staff statistics from both browsers.

I screwed two buttons for donations: from the paper and Yandex.deg. By the time the second version was published, I received exactly zero donations. I can not say that I was very surprised. As it is known, very few projects can collect donations. I wanted to make the second version of the extension conditionally paid: the full functionality would appear 10 days after installation. If someone wanted before, then you would have to pay some symbolic amount. A few things stopped me (I have no legal entity). The first is the lack of adequate payment systems for non-residents of the United States. Found only Paypal, in which I have an account in euros. According to statistics, I saw that the majority of users of the Chrome-version of the extension from the States. I was not sure that they would be willing to pay 1 euro for the extension and another 1.5 for related costs. In addition, it was necessary to organize payment acceptance and reliable (affordable) storage / receipt of information about them, which means that the server part of the extension is needed.
The second is ethical considerations. I have nothing to do with Google, so why should I parasitize on it, even spending my own time ?! I got experience, and money is better to make money on something that will be completely mine.

Version update


Chrome supports auto-update versions, but if you change the list of necessary permissions in the new version, auto-update is disabled. The user will have to find out for himself that a new version has been released and to click the “Update all installed extensions” button himself. In the Opera, the situation is similar. After changing the access rights in the manifest, messages about the new version did not come.

Results




Links: version for Opera , for Chrome , source code .


UPD: Wimsey clarifies that there are auto- updates in Opera. Text corrected.

Source: https://habr.com/ru/post/133543/


All Articles