<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d8211560\x26blogName\x3dTech+Tips,+Tricks+%26+Trivia\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttp://mvark.blogspot.com/search\x26blogLocale\x3den\x26v\x3d2\x26homepageUrl\x3dhttp://mvark.blogspot.com/\x26vt\x3d-5147029996388199615', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Tech Tips, Tricks & Trivia

by 'Anil' Radhakrishna
An architect's experiments, little discoveries and annotated bookmarks.

Search from over a hundred HOW TO articles, Tips and Tricks


StopTabAlerts - a bookmarklet to replace dynamic blinking alerts in tab with custom text

There is a question on the SuperUser StackExchange forum where a person annoyed with the Gmail Chat notifications in the browser tab wants to hide the blinking messages. If  Doe sends you a chat response, you would see the message "Doe says…" in the browser tab's title alternating with the text showing the count of unread email in your Inbox.

Such blinking messages are shown using a timer written in JavaScript which make use of the setInterval method. My solution to the above scenario was to mask that timer with a timer of my own that sets a fixed text message (I used the text "Advanced Rocket Engineering" so that anyone snooping on your computer may be impressed with your deep interest in science). Now how do you activate the timer? I'm fond of bookmarklets, so I thought a bookmarklet could do the job of overriding the blinking messages with custom text with just a click while you're on the Gmail tab.

The actual bookmarklet cannot be placed directly in the answer on the Super User forum so to make it easy to drag and drop the bookmarklet to the Bookmarks Bar (in Chrome or Bookmarks Toolbar in Firefox or the equivalent in any other browser) I have the ready-to-use bookmarklet here - StopTabAlerts

javascript:setInterval(function(){
document.title='Advanced Rocket Engineering'
},200);

Is this an efficient solution? I don't know. I did some basic testing in Chrome and it worked. If the code can be improved, please let me know.

The bookmarklet can be adapted for other scenarios where you want to get rid of blinking alerts in the browser tab.

Labels: ,

Tweet this | Google+ it | Share on FB

« Home | Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »

»

Post a Comment