Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

New Entry In DB Sound Alert

  • 25-05-2006 02:38PM
    #1
    Registered Users, Registered Users 2 Posts: 224 ✭✭


    Hi,

    I wonder is it possible to give a sound (be it mp3 or wav or whatever) everytime an new entry appears on a dynamic webpage. I currently have a help desk type page set up that refreshes every 30 seconds. Is it possible to have an audible alert when a new entry arrives???


Comments

  • Registered Users, Registered Users 2 Posts: 3,514 ✭✭✭Rollo Tamasi


    it certainly is possible with AJAX anyway because within gmail when you receive an instant message you get the same "bleep" sound as you get when you receive a instant message from the program. I wouldn't have a notion about AJAX myself though


  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    A simple solution may be embedding the sound in the web page if a new item has appeared in the list, then set the sound to play once when the page has loaded.


  • Registered Users, Registered Users 2 Posts: 224 ✭✭The Mighty Dubs


    seamus wrote:
    A simple solution may be embedding the sound in the web page if a new item has appeared in the list, then set the sound to play once when the page has loaded.

    I dont think that will work properly because when the page automatically refreshes every 30 seconds and I dont want the alert to be going off every 30 seconds only when a new entry is added...if you get my drift


  • Registered Users, Registered Users 2 Posts: 684 ✭✭✭Gosh


    If it's a dynamic page then you would only include the sound play on "<body onLoad=" if you had new items in the list


  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    I dont think that will work properly because when the page automatically refreshes every 30 seconds and I dont want the alert to be going off every 30 seconds only when a new entry is added...if you get my drift
    What Gosh said. You only embed the sound if there is a new entry in the list.

    If you're wondering how to find out that there is a new entry in the list, then you're best to use cookies. You store a cookie on the machine that holds the date/time that the page was last loaded on that machine. If there are items that have been added after that date/time, then you embed the sound. If not, the sound doesn't get embedded. Then you reset the cookie to store the current date/time.

    That's just a simple way. There are better ways.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 684 ✭✭✭Gosh


    Another method would be to throw up an alert on page load as follows
    <script type="text/javascript">
    function NewItems()
    {
    alert("There are new items on this page");
    }
    </script>
    
    <body onLoad="NewItems()">
    

    As said before only include the onLoad if you know there are new items. (In IE you get a sound as well when this box is displayed)


Advertisement