Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximizing the current window in javascript

Is there a way I can maximize a currently minimized window from Javascript? Here's my situation:

I have a series of links that all target the same external window (e.g. "MyNewWindow"). When I click a link, a new window pops up. If I click another link, the page pops up in the same window as expected. If I minimize the "MyNewWindow" popup, I'd like to be able to click another link and have that window maximize.

My approach was to put something on the onLoad part of the body so that when the page is refreshed it will automatically "maximize" if it is minimized. Note: Using window.MoveTo() and window.resizeTo() doesnt seem to do the trick (the window stays minimized).

Thanks!

like image 579
Ka Wai Cheung Avatar asked Dec 23 '22 02:12

Ka Wai Cheung


1 Answers

For all of you know-it-alls, there are perfectly good reasons to want to know how to do this. Here's the reason I needed this:

  • I'm deploying SCORM modules to a variety of Learning Management Systems (LMSs)
  • One LMS that a client is using launches the module in a small (600x400) window, with the user controls to maximize or resize said window DISABLED
  • The client doesn't know how to change this launch behavior

My only option is to try to maximize via javascript, because the idiots who made the LMS took away the user's ability to manage their own windows.

window.moveTo(0, 0);
window.resizeTo(screen.availWidth, screen.availHeight);

This may not work in IE depending on the security zone your page is falling under, and it may not work in Chrome at all. But for a corporate environment in an intranet, it has a good chance of working.

like image 143
jrb Avatar answered Jan 08 '23 01:01

jrb