Make my browser blink as an indicator

My colleague wrote a quick mvc chat application so that we can communicate with work without leaving our desks.

How can I indicate each other a new message? My first thought was that the browser title bar is blinking. Does anyone know how?

+3
source share
4 answers

Unable to make browser blink in javascript. Ability to set the document name to empty, and then write it again using a time period using setTimeout ()

+8
source

You can play a tone or other sound clip when a new message appears.

, , , . , , .

, , .

+5
+2

, , :

, , , (.. window.onmousemove).

function Alert(msg [, ti]) { 
// msg = the message, ti= time interval between title changes(default is 1.5s)
    var intervalId, oldTitle = document.title;
    intervalId = setInterval(function(){
        document.title = document.title == msg ? oldTitle : msg;
    }, ti ? ti : 1500);
    return function() {
    if(oldTitle) {
        clearInterval(intervalId);
        document.title = oldTitle;
    oldTitle = intervalId = null;
    }
    };
}
+1
source

Source: https://habr.com/ru/post/1759360/


All Articles