In a previous post, I demonstrated how to create a custom App Launcher using the Management API and Override Pages framework. However, this approach didn't allow users to retain their custom NTP and utilize webstore apps concurrently. Thus, I developed "Quick Launch," a browser action extension that addresses this issue. The extension reuses much of the NTP tutorial's code but utilizes the 'browser_action' in the manifest, enabling a popup.html to display installed apps upon clicking the extension's icon. The popup.html dynamically generates a list of installed apps using the Management API and displays them with their icons. The source code is available on GitHub.
This post concludes the "Buzz This" Chrome Extension series by demonstrating how to add context menus. Context menus provide a powerful way to interact with users, letting them "Buzz" specific content like images or selected text, rather than the entire page. This is achieved by adding "contextMenus" to the permissions in the manifest file and then using chrome.contextMenus.create() in the background.html file. The create() method takes an object that defines the context menu's title, contexts (e.g., "page", "selection", "image", "link"), and an onclick event handler. The click handler determines the context of the click (selected text, image, link) and constructs the Buzz API URL accordingly. The code for the extension is available on GitHub.
In this follow-up tutorial, we enhance the "Post to Buzz" Chrome Extension by adding a share count to the browser action button. This involves making cross-domain requests to the Buzz API's buzzCounter endpoint. We've updated the manifest file to include necessary permissions and added code to background.html to handle tab changes and URL updates. The code retrieves the Buzz count for the current URL and displays it on the browser action button, providing users with real-time feedback on share activity. This subtle update enhances the user experience and provides valuable context within the extension.
This tutorial provides a step-by-step guide to building a basic Chrome extension for posting to Google Buzz. We start by setting up the manifest file with the extension's name, version, and browser action details like the icon and tooltip. Then, we introduce a background page to handle the extension's logic, adding an event listener to detect clicks on the browser action button. Initially, we demonstrate how to display the current URL, and then extend the functionality to open a new tab directed to Google Buzz, pre-filled with the current URL for posting. The tutorial concludes by adding the 'tabs' permission to the manifest for enabling tab creation. Future enhancements will include fetching Buzz stats for the current URL, demonstrating cross-domain requests and browser_action interaction.
I've created a simple Chrome extension that lets you post the current page to Google Buzz and see its popularity. In upcoming posts, I'll use this example to demonstrate how easy it is to build Chrome Extensions and add cool features, like using Browser Actions, the Tabs API, Cross Domain Requests, and the Context Menu API. Check out the extension and its code on the Chrome Web Store and Github.