Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to check table for new content, and then update browser tab title?
    primarykey
    data
    text
    <p>I am working on a way to flash a browser tab when a new message appears in a table. I have the flashing of the tab part working, my only problem is that I can't seem to get it to flash when a message is received (which is the whole point of my exercise :) )</p> <p>The <code>newMessage()</code> function is working fine, I just can't seem to get the <code>notification()</code> function to work.</p> <p>My code is as follows:</p> <pre><code>function newMessage() { var oldTitle = "Your Page"; var msg = "New Message"; var timeout = setInterval(function() { document.title = document.title == msg ? '' : msg; }, 1000); window.onmousemove = function() { clearInterval(timeout); document.title = oldTitle; window.onmousemove = null; }; } function notification() { var index = 2; var content = document.getElementById('refreshMessages').childNodes[index]; var content = document.getElementById('refreshMessages').getElementByTagName("tr")[1]; var knownContent = content.toString(); updater.start(); updater2.start(); var newContent = document.getElementById('refreshMessages').childNodes[index]; var newContent = document.getElementById('refreshMessages').getElementByTagName("tr")[1]; if(knownContent != newContent.toString()) { newMessage(); knownContent = newContent; } else if(knownContent = newContent.toString()) { alert("No need to flash title."); } } notification(); </code></pre> <p>In the <code>notification()</code> function, I am trying to call the <code>newMessage()</code> function by comparing the strings at the appropiate cell in the table.</p> <p>I put the <code>alert()</code> into the else if just to see if it would be called, but it does not happen. <code>update.start()</code> and <code>update2.start()</code> are carried out however, as I can see the messages appearing in the table.</p> <p>I would be happier to use JavaScript but I am open to jQuery also.</p> <p>My JavaScript is very very rusty so excuse me if I have made any silly mistakes!</p> <p>Thanks,</p> <p>Chuck</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload