Archives for posts with tag: HTML

Today I learned that to give an element “ignore the cursor” status, drop this bad boy in your stylesheet:

pointer-events: none;

What a pleasant surprise, my hovering div became ‘invisible’ to the cursor, allowing me to click the image link below, THROUGH the div!

Pointer-events: none; is my new favorite line of CSS.

Pointer-events: none; is my new favorite line of CSS.

Magic.

 

Advertisements

Chrome extensions are simpler than you think. They’re written with web languages and can be as simple as pure HTML, CSS, and a few lines of Javascript. Right now we’re going to make a ‘browser_action’ extension.

Download this .zip file and follow along! Extensions are fun and easy!

An extension is entirely based on one file called manifest.json. The manifest.json file contains your extension’s information and tells Chrome what the extension will do. The necessary elements for browser_action are default_icon, which links to the icon you see in the corner of your browser, and default_popup, which is the ‘page’ that opens when the icon is clicked. But enough babbling, let’s get started on your first extension!

1. Create a folder for your extension!

(Or download this .zip file and follow along!)

2. Create your manifest.json!

Create up a new text file in your extension’s folder and name it manifest.json, then add the following code:

{
 "manifest_version": 2,
 "name": "My First Chrome Extension",
 "description": "Description of your extension goes here.",
 "version": "1.0",
 "browser_action": {
    "default_icon": "icon.png",
    "default_popup": "popup.html"
 }
}

3. Create your popup.html!

Next, create your popup.html file. In this file, put whatever you want to be in your pop up! Here’s what mine looks like:

<!doctype html>
<html>
  Hey there!
</html>

4. Every great extension needs an icon.png!

icon

Finally you need an icon. Download this one for our demo! browser_action icons need to be 19×19 pixels, and should use alpha transparency so they look good on different themes.

Got your manifest.json, popup.html, and icon.png files? That’s it! You’re extension is ready to be installed!

Unpacked Extension Installation

Screen Shot 2013-05-12 at 4.27.55 PMGo to chrome://extensions, check that you’re in Developer Mode, and click Load Unpacked Extension. Select the directory containing your manifest.json, popup.html, and icon.png files and presto! Your extension lives! Wasn’t that easy?

Imagine the possibilities. Anything you can build on a website, you can build in a Chrome extension. We’ve barely scratched the surface of what’s possible with extensions. If you’re thirsty for more, check out this fun and informative post on Lifehacker, and the extremely helpful official Google Chrome Developer Documentation.

I hope you had as much fun making your first Chrome extension as I did writing this. Don’t be shy, let me know if you write any sweet extensions!

Don’t forget to follow me on Twitter & Dribbble, happy extensioning!