Update window title when new notifications are pending
-
Thadd Selden
- Assigned user set to Thadd Selden
-
Thadd Selden
This isn't quite as easy as it first seems. Changing the title is simple, just say:
document.title = "New title"The challenge is that you don't have a way to know that the user is not viewing the page at the time unless the user has set their status as away. So, a notification will come in, the title gets updated, but then on the first message update the notification is cleared and the title goes back to normal.
-
Thadd Selden
An idea:
A hidden status field could be set via a function like the following:
window.onblur = function() {jQuery('#window_hidden').html('true');} window.onfocus = function() {jQuery('#window_hidden').html('false');}The notification AJAX response can then check the content of this div to determine whether to change the title.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.