New hub “Chrome Extensions” (from October 2014 - “Extensions for browsers”)

    A change has occurred in the hub classifier . All the numerous articles about Chrome extensions can now be marked with this hub , which I urge to make authors of previously written articles. In addition, on the occasion of the holiday, I would like to write a review about the history of the extensions and user scripts of Chrome, about how they formed and what kind they came to.


    Persistent but Doubtful Growth: Advertising Cutters


    At first, many years ago, in the years 2000-2005, there were no browser extensions in the form in which we see them now. Scripts in the browser were implicitly written by the authors of the site and the page observed in the browser. It would seem that there is nothing strange in this - the authors of the site have the full and undivided right to use browser resources ... stop. Found a scythe on a stone. Why should authors of the page use the resources of my browser? To write your own arbitrary scripts that do not allow to show the contents of your own page? Distract bad styles from the content of your page? And the advertisement on it?

    And the inquisitive thought of the user earned. My browser - by definition, it should bring convenience to me, and not promote the interests of the owner of the site that I am currently considering. No, of course, there are masochists who will defend the right of the author of the site without being authors, but not everyone will agree with them. An example is redundant or not very, advertising that is not related to the content for which the reader came. Or imperfections or errors in the design of the pages. Or the desire of the reader to see additional information on the same page. All this leads to the desire to have a mechanism next to the browser that processes some parts of the pages.

    For example, the earliest examples of page processing were implemented as a local proxy server through which pages were passed to filter its contents, mainly to remove ads. History remembers the attempts of lawsuits by website owners against the creators of these programs. For example, there was a legendary representative of this class of programs, Proxomitron , whose author in June 2003 refused to support and develop his program because of pressure on him that threatened to result in prosecution. There were several such examples, but after a couple of years there were so many proxy programs that it became pointless to deal with them, and there were practically no real examples of the struggle - there were only some programs that stopped developing.

    At the same time, it is not necessary that the language in which the parser of advertising inserts was written was Javascript. The ad blocker language was and is declarative and specialized, it remained so in the most famous AdBlock Plus - a blocker that was formed already in the era of browser Javascript extensions. At the same time, the blocker program could parse input pages in a proxy server in Python, for example. The main purpose of blockers is to cut parts of the page, most effectively looking for unnecessary, without violating the frame (layout) of the page.

    Read more about the contemporary relationship blockers and advertisers (Eng.) - www.computerworld.com/s/article/9245190/Ad_blockers_A_solution_or_a_problem_ .

    Custom styles


    Another class of page impact ideas is page modification. since CSS rules affect the display to a large extent, the next idea came up - to mix your user rules into many CSS rules. By the way, they can partially perform tasks on hiding unnecessary blocks, although not as efficiently as HTML cutters. But they have a plus in the fact that style rules continue to affect the page even when dynamically modifying the DOM (structure of page elements), which is becoming more and more typical in recent years, starting around the borders of 2008-2009. In addition, style modifiers perform not only a destructive, but also a design role, can refine or simply change the original style of pages.

    It is easy to mix styles through the inclusion of CSS rules in HTML using the proxy server method.

    Custom scripts


    You can prevent the proxy server from introducing Javascript scripts into the site page, but you cannot modify subsequent DOM changes (except for the case of the introduction of hand-written scripts instead of or in addition to site scripts). To facilitate the access of scripts to page space over the course of the evolution of browsers, user scripts were invented. The first version of the Greasemonkey Firefox add-on appeared in March 2005and allowed you to write short and simple user scripts. More precisely, it was possible to modify the behavior of the browser (Internet Explorer plug-ins, add-ons and Firefox plug-ins) before, but the whole question was the complexity of the intervention, the support of the method of intervention with the appearance of new versions of browsers and the compatibility of the user plug-in with others. The range of technologies and the threshold of entry were methodically reduced so that a small impact on the site with the help of its script was simple and that it did not conflict, if possible, with the development process of the browser.

    Again, there is no reason to refuse proxies for scripting. After all, user scripts actually started at the moment the web page was finished loading, and this was worse than the introduction of tags with scripts included, because all the other tags with the site scripts had time to start and execute. If desired, the site script could counteract user scripts more successfully than they could with page scripts. But not a single script was completely suppressed, because each has its own local environment for script variables for its execution. (Compete for common resources like Global Scope and DOM, rewrite them - yes, any of these scripts can.)

    Another argument in favor of including proxies against user scripts is universality for various browsers. It is easy to accustom any browser to working with a proxy server, but not all browsers at first had a mechanism for implementing user scripts in their arsenal. It is interesting that pretty soon all new browsers considered it their duty to have similar implementation mechanisms and supported the Greasemonkey functions, which became the de facto standard, except for browsers of the IE family, but they also had ways to implement user scripts using third-party programs. True, IE for a long time, before version IE9, had a very different way of working with the DOM at the Javascript level, which determined its isolation from the mainstream development of browsers. In IE11, browser developers have tried to minimize these differences. But the problem remains in reaching users by platform (operating system). IE11 can only be installed or comes initially with windows 8 (from June 2013) and Windows 7 (from November 2013). Users of other operating systems can not even install this browser, except for the use of virtual machines. Therefore, the number of potential users of the browser and user scripts in it is greatly limited by the distribution policy.

    A similar situation with limited distribution has developed with the Safari browser since May 2012, when the latest Safari 5.1 update for Windows was released and then it did not develop on this system and the rest, except for Mac OS. But up to this point, developers could count on a fairly large coverage of userscripts on Windows and Mac OS platforms.

    In Opera 8.0 in April 2005, support for user scripts also appeared , along with Firefox. In contrast, the Opera had no add-ons for a long time, and you had to install scripts manually (create a script file) and through the browser settings.

    In addition, it must be said that users of user scripts, user styles, and proxy servers were quite few in relation to the total number of site visitors. For the most part, these technologies are made by geeks for geeks, and the relative ease of installing scripts through Greasemonkey is itself a great and atypical achievement.

    The problem is not only that scripts bring an additional danger of access to user data. The first problem is that convincing the user to make unnecessary movement and installing the add-in program is a difficult task, which can be done for about 1-5% of the total number of users of any site. Basically, after all, the owners of the sites tried to make them user-friendly, so there was not often a strong need for a change in functions and design.

    Even the add-ons discussed below, which were able to reduce the installation distance to 2 clicks, could not and will not be able to solve the problem of user trust in extraneous add-ons. All add-ons will remain marginal as long as there is a trustworthy site owner. And if there is no trust, another site with a different owner, causing confidence, will appear on the Internet rather than someone massively “saving” the first site, wholly depending on the donor site.

    Browser Addons


    User scripts that run after page scripts are run do not always suit (a few of them) users. The page script managed to do something unnecessary, spoil the look, flicker with a banner, and generally spend the processor time on its execution. Therefore, Firefox, starting with versions 0.X, had an initial approach to the idea of ​​building a system of plugins that are easier to write than IE plugins and than the plugins of Firefox itself that have not disappeared. If the task allows us to limit ourselves to a smaller range of technologies than knowing the entire structure of the browser, then it was solved within the framework of building an add-on (add-on) based on XUL technology (XML User Interface Language), made specifically for working with Firefox, the Gecko engine and based on it products.

    Over time, this approach was revised, and for Chrome add-ons, which were called "extensions", they no longer invented a new language and technology (similarly to Safari extensions). Everything is built on HTML and Javascript API. Over time, it was necessary to create many similar add-ons, APIs multiply, partially overlapping, in Chrome Apps, Chrome OS, but the approach does not look slow and does not create a specific entry threshold. There is a threshold, but it is determined by the structure of applications as frameworks (for example, you need to know the purpose of the manifest.json file elements) and the number of API functions.

    Eventually


    As a result, the zoo of browsers did not get a very diverse, which is already good, zoo of add-ons, extensions and scripts.

    * Greasemonkey and Scriptish in Firefox - addons.mozilla.org/en-US/firefox
    * user scripts in Firefox, Chrome, Opera and Safari (with NinjaKit) - userscripts.org
    * extensions of the old Opera; of the new Opera - addons.opera.com/en/extensions
    * Chrome extensions - chrome.google.com/webstore/category/extensions
    * Chrome applications - chrome.google.com/webstore/category/apps
    * Safari extensions - extensions.apple. com

    You can recall, already in the past tense, about extensions of the old Opera, which were relatively few, but they were quite simple at the level of complexity of the Safari and Chrome extensions. New extensions for the new Opera, built on the same engine as Chrome, have a minimum of differences in functionality from the Chrome extensions. Most likely, there are limitations due to the unrealization of the specific features of the Chrome browser, but not differences in engines and APIs.

    In percentage terms, the branch of Chrome extensions is most actively developing. This is the most popular and fastest browser that works everywhere, a well-developed and flexible API, and ease of access to it.

    As examples, many extensions can be cited, some of which were made specifically for the Habrahabr site and focused primarily over Chrome over the past 2 years.

    Theory:

    On the subject of Habr:

    Others:


    UPD 10/18/2014: the hub was renamed to "Extensions for browsers", as was proposed almost initially . A few months is a good reaction period, it is constantly being reduced.

    Also popular now: