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.

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 ChromeTheme.net 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.”

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? <!

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 "

The Daily Routines of Famous Writers By Maria Popova UPDATE: These daily routines have now been adapted into a labor-of-love visualization of writers’ sleep habits vs. literary productivity. Kurt Vonnegut’s recently published daily routine made we wonder how other beloved writers organized their days. So I pored through various old diaries and interviews — many from the fantastic Paris Review archives — and culled a handful of writing routines from some of my favorite authors. Enjoy. Ray Bradbury, a lifelong proponent of working with joy and an avid champion of public libraries, playfully defies the question of routines in this 2010 interview: My passions drive me to the typewriter every day of my life, and they have driven me there since I was twelve. Joan Didion creates for herself a kind of incubation period for ideas, articulated in this 1968 interview: I need an hour alone before dinner, with a drink, to go over what I’ve done that day. E. I never listen to music when I’m working. Photograph by Tom Palumbo, 1956

Message Passing Since content scripts run in the context of a web page and not the extension, they often need some way of communicating with the rest of the extension. For example, an RSS reader extension might use content scripts to detect the presence of an RSS feed on a page, then notify the background page in order to display a page action icon for that page. Communication between extensions and their content scripts works by using message passing. Either side can listen for messages sent from the other end, and respond on the same channel. A message can contain any valid JSON object (null, boolean, number, string, array, or object). There is a simple API for one-time requests and a more complex API that allows you to have long-lived connections for exchanging multiple messages with a shared context. If you only need to send a single message to another part of your extension (and optionally get a response back), you should use the simplified runtime.sendMessage or tabs.sendMessage .

The Art of Being Still Draft is a series about the art and craft of writing. Many of the aspiring writers I know talk about writing more than they actually write. Instead of setting free the novel or short story or essay that is sizzling at the ends of their fingers, desperate to set fire to the world, they fret about writer’s block or about never having the time to write. Yet as they complain, they spend a whole lot of that precious time posting cartoons about writing on Facebook or putting up statuses about how if they only had more free time they just know they could get their novels written. The problem is, too many writers today are afraid to be still. The people who see me out in the world might scoff at this since I am nearly always in motion, but those who know me best realize that I am being still even in my most active moments. Most writers today have jobs or families or responsibilities, and most often, all three. There is no way to learn how to do this except by simply doing it. Sarah Williamson

Related: