Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Giving Focus to Minimized Web Page

Status
Not open for further replies.

gi11ies

Programmer
Mar 26, 2002
52
Hi

Hi, I posted this in the .NET forum - but was told I'd probably have better chances of a response here ... which I kind of thought, since I am using DOM.

I am developing a web page based messaging system, where users log in, and if there is a message they are told on the web page they have a new message(s).

I have a user control in an iframe on the page that checks for a new messages every 30 seconds or so, Im wondering if the user minimizes the web page, is there anyway to make the minimized web page flash (go navy to give it focus in the task bar as to notify the user that there is a new message ... or any other method? Am guessing JavaScript maybe?

Any tips would be great.

Gillies
 
It might (untested, doubtful) be possible by popping an alert box up, or failing that, in IE only you might find some sort of ActiveX control or API call... but apart from that, I don't like your chances.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
I attempted to do this for an AJAX based messaging web application. You can't do it. Popping an alert does the trick in IE (but leaves the alert up which is annoying).

I found a solution that worked for me was to use javascript to change the TITLE of the page... and to then set it back when you have read the new messages.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
hmm, you can try something like this:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]

<html>
<head>
<title>Untitled</title>

<script type="text/javascript"><!--
function doIt() {
    setTimeout("doStuff()", 5000);
}

function doStuff() {
    window.moveTo(-99999,-99999);
    window.moveTo(0,0);
}
//--></script>

</head>

<body onload="doIt();">

</body>
</html>

of course, you'd have to customize it to only move when a new message has been found. rather than blink, this will bring the window into focus. maybe it's good enough for you...

*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top