Playing a sound if the user isn't on the page (IE window isn't top)

Discussion in 'jQuery' started by BlueVM, Sep 22, 2011.

  1. #1
    How would I go about playing some sort of a sound using jQuery only when the user is on another tab/window in their browser or their browser is minimized....


    Im sure it will include something similar to:
    $('body').append('<embed src="/path/to/your/sound.wav" autostart="true" hidden="true" loop="false">');
    Code (markup):
    But Im unfamiliar with the function, if there is one to only execute if not "top"...
     
    BlueVM, Sep 22, 2011 IP