Take the 2-minute tour ×

I am trying to make an insanely simple Chrome extension. All I want is the following: a "browser_action" toolbar icon that when clicked either does one of the following (either is fine):

  • Displays a popup with a link that says "Full Screen" and clicking the link resizes the chrome window to the full size of the screen. (preferable)
  • Simply makes the screen full sized by clicking the toolbar icon itself. (still ok)

This should be easy, I've made chrome extensions before but I can't get it to work. Everytime I try to use the chrome.windows api from either my popup.html, a js included in popup.html, or something similar Chrome simply blocks be from doing anything. I even tried injecting code into a dummy tab like this:

chrome.browserAction.onClicked.addListener(function(tab) {
var bkg = chrome.extension.getBackgroundPage();
chrome.tabs.create({url: "http://www.google.com"}, function(tab) {
    chrome.tabs.executeScript(tab.id, {file: "newtab.js"}, function() {


Where app.js contains the chrome.windows code to resize the window. And every time I get nothing. I have "permissions" : ["tabs","http://*/*", "https://*/*"] but I still can't do this very simple task. Ideas?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I was using Chrome 19, updated to 26 and it works. Windows API must have been added somewhere in between Full screen would look something like this (in a background script):

chrome.windows.getCurrent(function(wind) {
var maxWidth = window.screen.availWidth;
var maxHeight = window.screen.availHeight;
var updateInfo = {
    left: 0,
    top: 0,
    width: maxWidth,
    height: maxHeight
chrome.windows.update(wind.id, updateInfo);});
share|improve this answer
add comment

Your Answer


