When the user is changing the tab. I want to play notification sound and change the title of the page to grab attention.
How can I do it with JavaScript.
This is the code I have used and isn't working.
<script>
var message = "Come Back...";
var original = document.title;
window.onblur = function () { document.title = message; }
window.onfocus = function () { document.title = original; }
</script>