background preloader

How to Build a Chrome Extension

How to Build a Chrome Extension
Related:  Chrome Extension

Developing Google Chrome Extensions It's no secret that my favorite browser is Google Chrome. I like it because it's fast, reliable, it doesn't crash (very often), and it looks good. There's also something else which I find even more valuable. It's the fact that you can build an extension for it using only HTML, CSS, and JavaScript. So at the end of this article you will find a working Chrome extension which uses most of the techniques explained below. If you're looking for a quick solution, you could also download the Chrome App Maker from Envato Market, which makes it very easy to create Chrome apps and extensions. I always encourage people to use better tools to speed up their workflow. Thankfully there is a way to test your extension without having to upload it to Chrome's web store. Make sure that you check Developer mode and click the Load unpacked extension... button. Here's a diagram of the architecture for a Chrome extension: And now let's take a closer look at each element within the architecture.

storage Overview This API has been optimized to meet the specific storage needs of extensions. It provides the same storage capabilities as the localStorage API with the following key differences: User data can be automatically synced with Chrome sync (using storage.sync). Your extension's content scripts can directly access user data without the need for a background page. A user's extension settings can be persisted even when using split incognito behavior. Manifest You must declare the "storage" permission in the extension manifest to use the storage API. Usage To store user data for your extension, you can use either storage.sync or storage.local. When Chrome is offline, Chrome stores the data locally. Confidential user information should not be stored! The storage.managed storage is read-only. Storage and throttling limits is not a big truck. Examples The following example checks for CSS code saved by a user on a form, and if found, stores it.

How to create your own Chrome theme | How To One of the great things about the Chrome browser is the ability to customize its appearance with the use of themes. The Chrome Web Store has a decent selection of themes to choose from, but if you're not thrilled with the premade themes, you can create your own. Here's how: If you're already familiar with JSON files, the Theme Creation Guide might be all you'll need to get started For the rest of us, there's a Web site called that has a Web-based Chrome theme creator. Step 1: Go to the Chrome Theme Creator. Step 2: If you just want to use your own wallpaper in the large white space of Chrome and be done with it, upload the wallpaper at the theme_ntp_background image element, then move on to Step 3. Step 3: When you've finished creating your theme, go to the "Pack" tab and click the "Pack and install theme" button. Step 4: At the Chrome prompt, click "Continue" to install the theme. That's it.

How to Make a Chrome Extension If you’re wondering how to make a Chrome Extension, Chrome’s extension documentation is great for basic implementations. However, to use more advanced features requires a lot of Googling and Stack Overflow. Let’s make an intermediate Chrome extension that interacts with the page: it will find the first external link on the page and open it in a new tab. manifest.json The manifest.json file tells Chrome important information about your extension, like its name and which permissions it needs. The most basic possible extension is a directory with a manifest.json file. That’s the most basic possible manifest.json, with all required fields filled in. Load your extension into Chrome To load your extension in Chrome, open up in your browser and click “Developer mode” in the top right. When you change or add code in your extension, just come back to this page and reload the page. Content scripts A content script is “a JavaScript file that runs in the context of web pages.”

Getting Started: Building a Chrome Extension Extensions allow you to add functionality to Chrome without diving deeply into native code. You can create new extensions for Chrome with those core technologies that you're already familiar with from web development: HTML, CSS, and JavaScript. If you've ever built a web page, you should feel right at home with extensions pretty quickly; we'll put that to the test right now by walking through the construction of a simple extension that will fetch an image from Google using the current page's URL as a search term. We'll do so by implementing a UI element we call a browser action, which allows us to place a clickable icon right next to Chrome's Omnibox for easy access. Clicking that icon will open a popup window filled with an image derived from the current page, which will look something like this: If you'd like to follow along at home (and you should!) The very first thing we'll need to create is a manifest file named manifest.json.

George Lakoff: Michigan's New Corporate Servitude Law: It Takes Away Worker Rights Michigan has just passed a corporate servitude law. It is designed to take away many of the worker rights that unions have conferred throughout their history: the right to a living wage. The right to equal pay for women. The right to deferred payments in the form of pensions. The right to negotiate workplace standards and working conditions. The law is intended to destroy unions, or at least make then ineffective. The deeper truth about unions is that they don't just create and maintain rights for workers; they work for and create crucial rights in society as a whole. Since Democratic candidates tend to support the same progressive views, defunding unions would take away their power to campaign for Democratic candidates. Language matters. Progressives and conservatives have opposing views of democracy. Conservatives don't accept this truth, if they perceive it at all. The press is not being neutral in using the Republican name for the law.

How to Create a Chrome Extension in 10 Minutes Flat One of my favorite things about the Chrome web browser is how extensible it is. It seems like there is a Chrome plugin for just about everything you could ever possibly want. But, have you ever wanted to create your own Chrome extension? In this tutorial I am going to show you how to create a basic Chrome extension in about 5 minutes—no joke! What we are going to build I’m pretty obsessed about the speed of my website, so I often utilize sites like GTmetrix to check my site speed, just to make sure it isn’t slowing down. I’ll often check other sites that I’m on as well, so I can see how they compare. Well, wouldn’t it be nice if there was a Chrome extension that allowed you to use GTmetrix to check the site speed of whatever site you happened to be browsing, just by clicking a button? I checked the Chrome Web Store and there wasn’t an extension that performed this action, so that’s exactly what we are going to build today. What is a Chrome Extension? <!

Making Your First Google Chrome Extension Martin Angelov The Google Chrome web browser is slowly growing in popularity. This is no surprise, as it is a great browser, and is backed by no other than Google. It also provides great tools for web developers and I find myself using it more and more (actually Firebug is the only thing keeping me from crossing to the other side). With the introduction of extensions, Google Chrome became even more agile and powerful. In this tutorial, we are going to create a simple extension, which puts a small icon next to Chrome’s address bar, and, when clicked, will fetch Tutorialzine’s RSS feed and display a fancy preview of our latest tutorials. First a few words about extensions. How Extensions Work Extensions in Google Chrome are basically webpages. The extensions are, however, treated a bit differently than your regular webpage, which is displayed in the browser. You also have the benefit (or the limitation) that your extension runs only on one browser. Tutorialzine's Google Chrome Extension <!

Bookmarx Adds Keyboard Shortcuts to All Your Bookmarking Actions Chrome: If you're a heavy bookmarker than you likely have a ton of different folders and sites in your browser storing all the amazing stuff you come across. If you want to speed up this process, Bookmarx is a Chrome extension that adds a few handy keyboard shortcuts to make bookmarking a breeze. Bookmarx defaults to Ctrl+X to load the bookmarks box (but you can change it if you need that for cutting). Everything else you do with bookmarking can be done with keyboard shortcuts, including creating folders, finding folders, flip through currently existing folders, and more. It's handy if you're the type that constantly bookmarks and organizes the web sites you come across. Bookmarx | Chrome Web Store via Addictive Tips

Tutorial: Debugging This tutorial introduces you to using Google Chrome's built-in Developer Tools to interactively debug an extension. To follow this tutorial, you need the Hello World extension that was featured in Getting Started. In this section, you'll load the extension and take a look at its information in the Extensions page. Load the Hello World extension if it isn't already running. As long as your browser is in Developer mode, it's easy to inspect popups. Go to the Extensions page ( and make sure Developer mode is still enabled. The popup remains open as long as the Developer Tools window does. In this section, you'll follow the execution of the popup page as it adds images to itself. Set a breakpoint inside the image-adding loop by searching for the string img.src and clicking the number of the line where it occurs (for example, 37): Make sure you can see the popup.html tab. Use the buttons next to the play/pause button to step over, into, and out of function calls.

Networked Knowledge and Combinatorial Creativity by Maria Popova Why creativity is like LEGO, or what Richard Dawkins has to do with Susan Sontag and Gandhi. In May, I had the pleasure of speaking at the wonderful Creative Mornings free lecture series masterminded by my studiomate Tina of Swiss Miss fame. These are pages from the most famous florilegium, completed by Thomas of Ireland in the 14th century. In talking about these medieval manuscripts, Adam Gopnik writes in The New Yorker: Our minds were altered less by books than by index slips.” Which is interesting, recognizing not only the absolute vale of content but also its relational value, the value not just of information itself but also of information architecture, not just of content but also of content curation. You may have heard this anecdote. Here’s the same sentiment from iconic designer Paula Scher on the creation of the famous Citi logo: Kind of LEGOs. And iconic novelist Vladimir Nabokov was a secret lepidopterist — he collected and studied butterflies religiously.

Content Scripts Content scripts are JavaScript files that run in the context of web pages. By using the standard Document Object Model (DOM), they can read details of the web pages the browser visits, or make changes to them. Here are some examples of what content scripts can do: Find unlinked URLs in web pages and convert them into hyperlinks Increase the font size to make text more legible Find and process microformat data in the DOM However, content scripts have some limitations. These limitations aren't as bad as they sound. If your content script's code should always be injected, register it in the extension manifest using the content_scripts field, as in the following example. If you want to inject the code only sometimes, use the permissions field instead, as described in Programmatic injection. Using the content_scripts field, an extension can insert multiple content scripts into a page; each of these content scripts can have multiple JavaScript and CSS files. For example, the glob "