Search code examples
alertirc

Webapp that causes browser to issue an alert?


I am not sure exactly how to ask this question as I am not sure of the terminology I should use. I am writing a web application that is essentially a browser based IRC client. I wish to replicate some functionality I see in clients like x-chat where when you get a personal message it will alert the window manager. In my window manager (Aweosme wm) it turns the program tab red, in windows I imagine it would cause the programs button on the task bar to blink.

Essentially it's a notification that tells the window manager that something has happened and the program wants your attention.

  • What is the terminology for this functionality?
  • Is it possible to make a webapp tell the browser to do this?
  • If 'B' is yes then how?

Solution

  • You can't really make your browser window blink in the task bar. For HTML5 a Notification API was planned and so far Chrome supports it, but it seems that it was dropped again.

    The only cross-browser possibilities to get the attention of your users are either to set the focus of the window:

    window.focus();
    

    or to change the title of your page:

    document.title = "New message!";
    

    See also this SO answer for a nice "blinky" implementation of changing document.title.