blinkOnNewMessage: function(dateObject, userID, userName, userRole, messageID, messageText, channelID, ip) {
		if(this.settings['blink'] && this.lastID && !this.channelSwitch && userID != this.userID) {
			clearInterval(this.blinkInterval);
			this.blinkInterval = setInterval(
				'ajaxChat.blinkUpdate(\''+this.addSlashes(this.decodeSpecialChars(userName))+'\')',
				this.settings['blinkInterval']
			);
		}
	},
	
	blinkUpdate: function(blinkStr) {
	
		if(!this.originalDocumentTitle) {
			this.originalDocumentTitle = document.title;
		}
		if(!arguments.callee.blink) {
			document.title = '[@ ] '+blinkStr+' - '+this.originalDocumentTitle;
			arguments.callee.blink = 1;
		} else if(arguments.callee.blink > this.settings['blinkIntervalNumber']) {
			clearInterval(this.blinkInterval);
			document.title = this.originalDocumentTitle;
			arguments.callee.blink = 0;
		} else {
			if(arguments.callee.blink % 2 != 0) {
				document.title = '[**** ] '+blinkStr+' - '+this.originalDocumentTitle;
			} else {
				document.title = '[ New message!!!] '+blinkStr+' - '+this.originalDocumentTitle;
			}
			arguments.callee.blink++;
		}
	},

Hi friends, I want to flash taskbar when user minimized window during chat.
I have above code which simply change the title name but i want to change the color also of taskbar.
How I can do it??
Please help???
Thanks in advance.....

Dani AI

Generated

Short answer: a regular web page cannot change the OS taskbar color or force the taskbar to flash. Browsers deliberately do not expose APIs that let a page alter OS UI. is correct on that point. To get the user's attention when the chat is minimized, use web-friendly signals instead (desktop notifications, favicon/title changes, audio), or use a native/Electron wrapper if you need true taskbar flashing.

Practical, cross-browser approaches:

  • Detect minimized/hidden state with the Page Visibility API and then trigger a desktop notification via the Notifications API. See MDN for Page Visibility API and Notification.
  • Swap the favicon periodically to create a visible “blink” on the taskbar icon in many OS/browser combos.
  • For installed PWAs, the Badging API can add a numeric badge to the app icon: Badging API.
  • If you must flash the real taskbar icon on Windows, build a desktop app (Electron can call the OS): Electron flashFrame or use the native Windows API FlashWindowEx.

Example: request permission and show a notification when the page becomes hidden.

document.addEventListener('visibilitychange', function () {
  if (document.hidden) {
    if (Notification.permission === 'granted') {
      new Notification('New chat message', { body: 'You have unread messages' });
    } else if (Notification.permission !== 'denied') {
      Notification.requestPermission().then(p => {
        if (p === 'granted') new Notification('New chat message', { body: 'You have unread messages' });
      });
    }
  }
});

Example: toggle favicon to draw attention (swap two icon URLs every 700ms).

function setFavicon(href) {
  let link = document.querySelector("link[rel~='icon']");
  if (!link) { link = document.createElement('link'); link.rel = 'icon'; document.head.appendChild(link); }
  link.href = href;
}
let blink;
function startBlink(a,b){ if (blink) return; blink = setInterval(()=> setFavicon(document.querySelector("link[rel~='icon']").href === a ? b : a),700); }
function stopBlink(defaultHref){ clearInterval(blink); blink = null; setFavicon(defaultHref); }

Notes: Notifications require user permission and can be suppressed by the browser/OS. Favicon tricks work in many setups but are not guaranteed everywhere. If full OS-level control is required, a native/Electron app is the correct path.

Are you talking about window's task bar? I am not sure you could actually do it using JavaScript because it is out of scope.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.