Cherry Cream Delight

I can’t believe the things I’ll eat when I’m on a plane.

Cherry Cream delight label

Cute!

Cherry Cream Delight ingredients

That's a lot of ingredients

Posted in Uncategorized | Leave a comment

Automatically pause video when it’s not visible

Download the Hold It! extension

I’ve built a Google Chrome extension called Hold It! that pauses video when it’s not visible.

For example, when you:

  • minimise a window with a video playing in it
  • move to a different tab
  • open a video link in a new hidden tab.

Video play resumes automatically when it becomes visible again.

Useful when viewing videos on multiple tab pages, or if you click a link to open a video in a new, hidden tab.

Works for YouTube, Vimeo and on any site that uses the HTML video element.

Caveats: does not work for YouTube advertisements, and does not work on bbc.co.uk and some other sites. If you have a solution, let me know!

You can get it (for free!) from the Google Chrome Webstore.

How to use the extension

After installing the extension, any playing video will be paused when you move to a different tab or minimise a window. If you click on a link to open a video in a new, hidden tab, the video will be paused until you move to the new tab.

How does it work?

This extension uses the Page Visibility API.

The API can be used to check when a web page is visible to the user or not.

If you minimise your browser window, or move to another tab, the API fires a webkitvisibilitychange event.

When a new page loads, the extension looks for videos on the page — including Flash video and HTML video elements. If the page is not visible, or becomes hidden, all playing videos on the page are paused. Play restarts (for videos that were playing) once they become visible again.

Posted in Uncategorized | Leave a comment

Win a Chromebook!

Chrome Web Store contest

Contest per lo sviluppo di applicazioni per il Chrome Web Store italiano.

Partecipa al contest.

Avete tempo fino a lunedì 12 Settembre 2011.

Posted in Uncategorized | Tagged , , , , | Leave a comment

Chrome extension to test navigation and page load speed

I’ve built a Google Chrome extension called Page Speed Test that uses the Navigation Timing API.

You can get it (for free!) at the Chrome Web Store.

The extension displays a timeline of navigation and page load events for the current page, and a historical chart of page load timing data for all visits to the page.

It’s still a bit rough around the edges, so I’d really appreciate any feedback.

Navigation and page load timing charted for all visits to the current page

Navigation and page load timing charted for all visits to the current page

Timeline of navigation and page load events for the current visit to the current page

Timeline of navigation and page load events for the current visit to the current page

Posted in Uncategorized | Tagged , , , | Leave a comment

Web apps need better context menus

Browser context menu

For web apps to be as good as native apps, they need better context (right click) menus.

Take a look at the screenshot above. This shows what happens when you click on a person in a Google+ circle: I’d like to move the person from the current circle to a different one.

A ‘proper’ context menu would be very useful in this case, but of course what I get is the usual generic browser menu with items that are irrelevant to the task I’m trying to accomplish.

I know that you can add items to context menus in Chrome apps, for example, or hack them in other ways, that there are security considerations (if people add deceptive menu items), that many (most?) users never use context menus, and so on.

BUT…

There must be a way.

Posted in Uncategorized | Leave a comment

The Page Visibility API

Framegrab from a Google Chrome promotional video: click to view the Page Visibility API demoI’ve built a simple demo of the Page Visibility API, based on an idea of Mike Mahemoff‘s and using his favicon.js.

The API makes it possible to find out when a web page becomes visible or hidden, for example to pause download, processing or playback in order to save CPU and bandwidth.

More information about the API is available from code.google.com and MDN.

I’ve also built a Google Chrome extension that uses the API to pause video when it’s not visible.

Posted in HTML, Uncategorized | Tagged , , | 12 Comments

AppleScript to view HTML in a browser with TextWrangler

TextWranglerI really like TextWrangler, the free Mac text editor from Barebones Software, who make BBEdit.

I’ve just worked out how to set up TextWrangler so you can view HTML files in one or more browsers — simultaneously if necessary, and with keyboard shortcuts.

Mike Piontek at Junecloud gives instructions on how to do this in Safari:

tell application "TextWrangler" to set theFile to file of document 1
tell application "Finder" to open theFile using (path to application "Safari")

Unfortunately, this doesn’t seem to work for Google Chrome.

So I did a bit of hacking (with help from a comment by someone called Rob on TUAW) and came up with this:

tell application "TextWrangler" to set theFile to file of document 1

set appleScriptPath to theFile as text
set currentURL to POSIX path of appleScriptPath
set currentURL to ("file://" & currentURL)

tell application "Google Chrome"
activate
if (exists window 1) and (URL of active tab of window 1 is "chrome://newtab/") then
tell window 1 to set URL of active tab to currentURL
else
open location currentURL
end if
end tell

It may not be elegant, but it works.

Posted in Uncategorized | Tagged , | 8 Comments