InstaChrome - A Google Chrome New Tab Extension

Last week, I made a small extension for the Google Chrome browser to replace the default “New Tab” page. I had previously tried extensions like Panda, but found them too distracting, and wanted something that would be nice to look at, but not too attention-grabbing.

InstaChrome is an extension for Google Chrome that allows you display the latest 6 instagram posts from a tag of your choice.

InstaChrome Screenshot

Download from the Google Chrome Store

With the exception of a few things, making this was like making a regular javascript application. As always, you can view the full app on my github. But here is an overview of how I made the extension.

Making a Chrome Extension #

There were two key things that this extension different from a regular web app - the manifest.json file, and storing data in the browser’s local storage.

manifest.json #

The manifest.json file is a required file that stores all the metadata for a Chrome extension. It is where we declare basic information such as the name and description of the extension, as well as functional information such as the permissions required and any overrides.

This was my manifest.json file -

// The version of manifest.json we are using
"manifest_version": 2,

// Required information about the extension
"name": "InstaChrome",
"description": "An extension for chrome that displays Instagram posts from a tag of your choice.",
"version": "1",

// Overriding the default behaviour for a new tab to redirect to our index.html file
"newtab" : "index.html"

// Allow use of chrome local storage
"permissions": [

// Allow requests from
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"

Working With Local Storage #

With this extension, I wanted to be able to save the last tag searched for in local storage so a user wouldn't need to search again everytime they open a new tab. To do this, we can use the API.

To store a variable, we use the set function on the storage area we want, in this case, local -{label : value}, function(){
// do something

To retrieve data based on a given label, we use the get function -, function(result) {
// do something

To remove data from storage, we use the remove function -, function() {
// do something

InstaChrome #

Having set all that up, this was my main app file -

"use strict";
$(document).ready(function() {

var request = function() {"tag", function(result) {

var tag = result.tag;
var cleanTag;

// Display # on the front end, but remove # for the cleanTag variable
if ( tag.indexOf("#") === -1 ) {
cleanTag = tag;
} else {
cleanTag = tag.split('#')[1];

cleanTag = cleanTag.replace(/\s/g, "");

var requestUrl = ''+cleanTag+'/media/recent?access_token='+accessToken+'&callback=?';

$.getJSON(requestUrl, {}, function(data) {

var items = [];

// Get only 6 items
for (var i=0; i < 6; i++) {

// Setup Handlebars templating
var source = $('#grams-template').html();
var template = Handlebars.compile(source);
var output = template( {Grams: items} );


if ( === 0) {
// Show error messages if no images for this tag
} else {
// Else, display the images in the template

}); // end get local storage
}; // end request

// When users search
$('#search').on('submit', function() {

// Clear messages and any previous images, and show loading animation

var searchInput = $('#searchText').val();

// Set the search text to local storage{"tag" : searchInput}, function(){

return false;

// On load of the new tab, check if there is any tag previously stored"tag", function(result) {

if ( result.tag ) {
} else {



You can check out the extension on github or download it from the Chrome store. If you use this extension, or have any feedback on how I can improve on it, do leave a comment below.

Keep in touch KeepinTouch

Subscribe to my Newsletter 📥

Receive quality articles and other exclusive content from myself. You’ll never receive any spam and can always unsubscribe easily.

Elsewhere 🌐