astralaaron Posted November 15, 2008 Share Posted November 15, 2008 not sure how many people have used gmail chat, but when you receive a new message the top of the browser window (normally blue, where the firefox or IE logo is) changes color to orange and back to blue, blinking back and forth to alert you... any idea how this is done?thanks in advance Link to comment Share on other sites More sharing options...
jeffman Posted November 15, 2008 Share Posted November 15, 2008 There might be a way to change the colors using proprietary IE commands, but of course they won't work in Firefox or anywhere else. (And I haven't been able to find them in the first 100 or so Google entries I tried. Sorry.)What you certainly can do everywhere is create the blinking effect. Using setInterval or setTimeout, change the value of document.title from "Something" to "" (empty string). Do it every second or so. Link to comment Share on other sites More sharing options...
astralaaron Posted November 16, 2008 Author Share Posted November 16, 2008 There might be a way to change the colors using proprietary IE commands, but of course they won't work in Firefox or anywhere else. (And I haven't been able to find them in the first 100 or so Google entries I tried. Sorry.)What you certainly can do everywhere is create the blinking effect. Using setInterval or setTimeout, change the value of document.title from "Something" to "" (empty string). Do it every second or so.they must know something we don't then because the only place I have seen it work is in firefox. I'm going to go try what you just wrote there thank you. Link to comment Share on other sites More sharing options...
astralaaron Posted November 16, 2008 Author Share Posted November 16, 2008 can someone let me know why this doesn't work? <script type="text/javascript">function start(){setInterval("change();",2000);}function change(){ var a = document.title; var i = 0; if(i == 0){ a.value=""; i = 1; return } else { a.value="asdf"; return }}document.onload = start;</script> Link to comment Share on other sites More sharing options...
astralaaron Posted November 16, 2008 Author Share Posted November 16, 2008 got it:<script type="text/javascript">function start(){window.setInterval("change();", 2000);}function change(){ if(document.title != "test"){ document.title="test"; return } document.title=" ";}</script>then for the body<body onmousedown="start();"> Link to comment Share on other sites More sharing options...
jeffman Posted November 16, 2008 Share Posted November 16, 2008 What you were up to the first time was actually the better practice. Only the statement needs to be this:window.onload = func; Link to comment Share on other sites More sharing options...
astralaaron Posted November 16, 2008 Author Share Posted November 16, 2008 hey I was messing around and did a window.onblur = functhe function makes an "alert()" happen..when i minimize the window in firefox the tab blinks exactly like I want it too orange... but there is a popup box that I dont want to pop up... I am thinking maybe theres something else that triggers the orange blink.. does that give you any ideas??**EDIT** Actually the function sets an interval that kept makeing alerts popup ... Link to comment Share on other sites More sharing options...
Synook Posted November 17, 2008 Share Posted November 17, 2008 Interesting... I didn't find a technique that will make the window blink, but I discovered one that will make the window automatically restore itself, if it is minimized (at least in Firefox) setTimeout("test = window.open(); test.close()", 5000); //will force a window restore in 5 seconds Link to comment Share on other sites More sharing options...
Ingolme Posted November 17, 2008 Share Posted November 17, 2008 Firefox uses the Window.getAttention method. It's probably not copatible with other browsers, so you'll have to find the one that other browsers use.Actually, it appears this method only works for "chrome" applications. Ones that run in the browser itself. Link to comment Share on other sites More sharing options...
astralaaron Posted November 17, 2008 Author Share Posted November 17, 2008 Firefox uses the Window.getAttention method. It's probably not copatible with other browsers, so you'll have to find the one that other browsers use.Actually, it appears this method only works for "chrome" applications. Ones that run in the browser itself.thanks a lot, I knew I didn't dream it **hm only chrome.. Link to comment Share on other sites More sharing options...
astralaaron Posted November 17, 2008 Author Share Posted November 17, 2008 Interesting... I didn't find a technique that will make the window blink, but I discovered one that will make the window automatically restore itself, if it is minimized (at least in Firefox) setTimeout("test = window.open(); test.close()", 5000); //will force a window restore in 5 seconds cool i have an idea for this one.I read a post somewhere about a guy complaining that his firefox stopped conveniently blinking his tab on the taskbar like it used to - someone replied about an addon to firefox.. Link to comment Share on other sites More sharing options...
jeffman Posted November 17, 2008 Share Posted November 17, 2008 This won't change the color, but it does create a blink effect. Notice the use of a blank space instead of an empty string. These keeps the browser from putting up a default title. Tested only in Firefox: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html> <head> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> <title>My Title</title> <script type="text/javascript"> function blink_title () { if (document.title == " ") { document.title = "My Title"; } else { document.title = " "; } } var blinking; function toggle_blink () { if (blinking) { blinking = clearInterval (blinking); } else { blinking = setInterval ("blink_title()", 1000); } } function init () { document.getElementById("blink_button").onclick = toggle_blink; } window.onload = init; </script> </head> <body> <div> <button id="blink_button">Toggle Blink</button> </div> </body></html> Link to comment Share on other sites More sharing options...
astralaaron Posted November 18, 2008 Author Share Posted November 18, 2008 thanks, Ill mess with it but I cant use the blinking title for this one anyway... the window has no address bar so it puts the website URL before the title on the tab.. you cant even see the title when its minimized.i read that it was a security issue so if you take the address bar off it shows the the url before title.. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.