Skip to content

Avian Bone Syndrome

An exercise in futility by Daniele Nicolucci

Menu
  • About ABS
Menu

How to use resizeTo in Safari (if it doesn’t work)

Posted on 2010-10-052010-10-05 by Daniele Nicolucci

Many people are probably familiar with the fact that most browsers allow Javascript code to be entered in the address field. That’s the magic behind bookmarklets, which simply spare the user the hassle of manually typing long, convoluted and obfuscated Javascript statements.

While it’s usually pointless to do so, there is one case in which it makes perfect sense: resizing the browser window to an arbitrary size, in order to test what a website looks like. Essentially, by setting the browser window to a size such as 1024 x 768, one can have a relatively reliable idea of what the current website would look at that screen resolution. In truth, one would have to take the graphical elements of the operating system in question, but it’s usually a fine way to get an idea.

The code to do so is very simple:
window.resizeTo(width, height);

Therefore, if we want to set the window to 1024 x 768 pixels, we type the following pseudo-address:
javascript:window.resizeTo(1024, 768);

and press enter. A few things worth noting:

  • Capitalization is important. It is resizeTo, with a lowercase “r” and a capital “T”
  • There is no space, nor any slash, after the colon
  • The width and height have to be separated with a comma, and (of course) have to be integers
  • The semicolon at the end is optional, but if you’re a programmer it will be natural to type it
  • In some browsers, you can omit the “window.” part, as the current window is implied

This is all good and great, and works in most browser.

Safari, however, only allows this intermittently. Since I spent some time making tests to figure it out, here is a tip: Safari will execute resizeTo only when there is one (and only one) tab in the window.

I’m not sure whether this is caused by a specific setting on my machines, or if it’s a default, or if it can be even changed, but I can see the point in this behavior. Since some websites have the bad habit of resizing the current window to full screen (an annoying and pointless habit, if you ask me), Safari blocks the execution of such command in order not to disrupt the concurrent navigation of different websites/pages.

It’s as if it said: “if this is your own window, do what you want with it; if not, you’ll have to respect your tab brothers.”

So, if resizeTo isn’t working for you, drag that tab out of the bar so it’s instantly opened in its own window, and try again.

Post navigation

← Languages: the strange case of Pirahã and Aymara
Printing in grayscale with AirPrint →

Written by a human

All text in this blog was written the old-fashioned way, without going through an AI / LLM. Any typos, mistakes and inconsistencies are proudly mine.

If you like this…

Did you enjoy reading this post without ads? If so, you may consider supporting this blog via Ko-fi!

Where was that?

Time travel

  • June 2026 (1)
  • May 2026 (1)
  • April 2026 (1)
  • November 2022 (1)
  • March 2022 (1)
  • December 2021 (1)
  • October 2020 (1)
  • August 2020 (1)
  • May 2020 (1)
  • March 2020 (3)
  • February 2020 (1)
  • April 2019 (1)
  • March 2016 (1)
  • July 2015 (1)
  • May 2015 (3)
  • April 2015 (2)
  • November 2014 (1)
  • August 2014 (2)
  • September 2013 (2)
  • April 2013 (1)
  • March 2013 (1)
  • October 2012 (1)
  • June 2012 (1)
  • March 2012 (1)
  • December 2011 (1)
  • November 2011 (3)
  • October 2011 (2)
  • July 2011 (1)
  • April 2011 (1)
  • January 2011 (1)
  • December 2010 (2)
  • November 2010 (1)
  • October 2010 (3)
  • September 2010 (16)
  • August 2010 (12)
  • July 2010 (10)
  • June 2010 (1)
  • May 2010 (7)
  • April 2010 (3)

Categories

  • Business (2)
  • Culture (13)
  • Electronics (4)
  • Huh? (1)
  • iOS (4)
  • Linguistics (11)
  • Music (8)
  • Personal (5)
  • Photography (10)
  • Podcast (5)
  • Science (7)
  • Society (28)
  • Technology (50)
  • Travel (2)
  • Tutorials (13)
  • TV (7)
  • Video games (6)

Tags

1984 (3) absp (3) apple (11) bluray (3) camera (4) communication (3) coronavirus (5) covid19 (5) culture (4) death (3) dream theater (4) ebooks (5) english (4) facebook (3) ios (8) ipad (4) iphone (10) iphone os (4) italian (3) italy (6) james labrie (3) jordan rudess (3) language (6) languages (3) linguistics (6) lockdown (5) mac (6) memories (3) mike portnoy (3) opus (4) orwell (3) os x (6) personal (4) photography (10) podcast (6) projects (3) rant (4) reading (4) spanish (3) the big bang theory (3) tutorial (12) tv (5) twitter (3) video games (6) work (3)
© 2026 Avian Bone Syndrome | Powered by Minimalist Blog WordPress Theme
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
SettingsAccept
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT