Resize Browser To Specified Pixel
Solution 1:
It's disabled by default in IE. And Chrome. And Opera. It can be disabled in Firefox too. There is a very good reason for this, namely that it's absolutely obnoxious. Everyone hates having their browser tampered with.
You can't stop the window being resized either, thank goodness, short of trapping onresize
and calling resizeTo
in response, for the last few browsers where that will do anything.
If you want a window that's a specific size, you can try window.open
ing a new one in that size. You can even ask for it to be unresizable. Although, again, many browsers will simply ignore your unreasonable user-hostile request.
Solution 2:
There is no reliable solution for all browsers. You can capture the onresize event, and fire a resizeTo, but as you know this doesn't work in all browsers. If you opened the ORIGINAL window, you can set it to a fixed size. I've had to do this for content in the past that has a specified viewable size. Also, what happens when viewing on my 1024x600 netbook?
Solution 3:
While it may work in some browsers, it may not work in others, depending on browser make, version and user preferences. For example, in FireFox you have:
Post a Comment for "Resize Browser To Specified Pixel"