/    Sign up×
Community /Pin to ProfileBookmark

Why is resizeTo method not working as expected?

What’s wrong with this code?

<a href="javascript:(function(){window.resizeTo(1280,720)})();">720pify</a>

I’m trying to use it to resize my browser window from a bookmarklet. I have it saved to bookmarklet.html and when I load and click “720pify”, nothing happens. I’m using Firefox.

I have seen it work in this 12 years old YouTube video, and in Firefox specifically. The guy in the video mentions specifically that this will work in Firefox and Safari, but not Chrome. I know it’s a 12 years old video, but what has changed since then that would render this code invalid? What I can tell has happened by looking at MDN on resizeTo is that Chrome supports this too now, and it is not deprecated or unsupported. Although it doesn’t work in Chrome either.

A simple alert works.

<a href="javascript:(function(){alert('hello world')})();">720pify</a>

But I have to make sure to use single quotation marks for the message. I now have a bookmarklet that greets the world when I click it. But I want to have one that resizes my browser window when I click it. How do I do that? And why is what I have here not working?

to post a comment

0Be the first to comment 😎



Help @Descartes spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.13,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ

legal: ({
terms: of use,
privacy: policy
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,