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?