• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1200
  • Last Modified:

minimize window

i want to trigger the same function when the user minimizes the window.
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
        window.setTimeout("OpenDialog()", 3000); // 5 secs

        function OpenDialog() {
               alert('hi');
        };
</script>
</head>
<body>
<p>Page content</p>
<div id="dialog">
        <p>
                Are you sure?
        </p>
</div>
</body>
</html>

Open in new window

0
yingwho
Asked:
yingwho
1 Solution
 
amit_gCommented:
There is no way to detect the browser minimizing.
0
 
shaziashaikhCommented:
There is no way to capture the window minimize event. However, depending on what you're doing and which browsers you're targeting, you could play around with the blur and focus events of the window to achieve similar effect.
0
 
72lionsCommented:
When the window is minimized the window.onblur is fired. And when your windows is restored the window.onfocus event will be fired.
You can also check the window.outerWidth and window.outerHeight (works in firefox).

Another technique is to add a flash object on the stage and on the resize of the window the flash will execute a javascript function with the ExternalInterface command.

Check the following links:

https://developer.mozilla.org/En/DOM/Window.onblur

http://codingforums.com/showthread.php?t=76312

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now