JavaScript JQuery : Play notification sound : IE8 Error jquery play notification sound

This code works perfect for crome and firefox.. but error in IE8

if($('#soundcheck').is(':checked')){
                    //alert('checked');
                    var audio = document.createElement('audio');
                    document.body.appendChild(audio);
                    audio.src = system_base_url+'/sound/horn.wav';
                    audio.play();

                  }

IE8 says: Object doesn't support this property or method, and it points to :

audio.play();

Anyone having similar experience with IE8?

Regards

Answer:1

The <audio> tag is HTML5 and is only supported in newer browsers, such as Internet Explorer 9, Firefox, Opera, Chrome, and Safari.

Answer:2

IE 8 and earlier does not support Audio tag, you need to use some hack. Hope it can help.

<audio id='audio' controls>
      <source src="audioes/song.ogg" type="audio/ogg" />
      <source src="audioes/song.mp3" type="audio/mp3" />
      <div>Your browser doesn't support HTML5 audio</div>
      <%--Fall back on the WMP plugin--%>
      <object id='mediaPlayer' type="audio/mpeg" width="200" height="40"><param name="src" value="audioes/song.mp3" /></object>
</audio>

<script type="text/javascript">
function play () {
    var audio = document.getElementByID('audio');
    var mediaPlayer = document.getElementByID('mediaPlayer');
    //HTML5 Audio is Supported
    if(audio['play']) 
    {
    audio.play();
    }
    //HTML5 Audio is NOT Supported
    else
    {
    mediaPlayer.object.play();
    }
}
    </script>
Answer:3

Possible Duplicate: Javascript outer scope variable access I have a javascript module that looks something like below. The main issue I'm having is how to access variables in the "this" scope ...

Possible Duplicate: Javascript outer scope variable access I have a javascript module that looks something like below. The main issue I'm having is how to access variables in the "this" scope ...

  1. javascript private inner class

i can find text of an element by using this code.but i want to find a single word any where in my page if mouse hovers on that word for certain time. $(document).bind("mouseover", function (e) { ...

i can find text of an element by using this code.but i want to find a single word any where in my page if mouse hovers on that word for certain time. $(document).bind("mouseover", function (e) { ...

  1. find word under cursor vim
  2. word find under the sea
  3. vscode find word under cursor
  4. emacs find word under cursor
  5. intellij find word under cursor
  6. vi find word under cursor
  7. eclipse find word under cursor
  8. visual studio find word under cursor
  9. vim find next word under cursor
  10. search for word under cursor vim
  11. search word under cursor vim
  12. get word under cursor vim
  13. word under cursor vim

I've attached an autocomplete function to a text input field in an html form. I can handle when the user selects something in the suggest box and it all works fine. I use "suggest" as source. My ...

I've attached an autocomplete function to a text input field in an html form. I can handle when the user selects something in the suggest box and it all works fine. I use "suggest" as source. My ...

Jquery Ajax call only fires once after that if i click on the button it does return the last returned reponse but doesn't go the ajax function in c# Here is my aspx code <asp:ImageButton ID="...

Jquery Ajax call only fires once after that if i click on the button it does return the last returned reponse but doesn't go the ajax function in c# Here is my aspx code <asp:ImageButton ID="...

  1. jquery ajax call example
  2. jquery ajax call to mvc controller
  3. jquery ajax call post
  4. jquery ajax call get
  5. jquery ajax call on button click
  6. jquery ajax call data
  7. jquery ajax call post example
  8. jquery ajax call synchronous
  9. jquery ajax call return value
  10. jquery ajax call in mvc
  11. jquery ajax call error
  12. jquery ajax callback
  13. jquery ajax call success
  14. jquery ajax call async
  15. jquery ajax call on click
  16. jquery ajax call url
  17. jquery ajax call rest api
  18. jquery ajax call success function
  19. jquery ajax call syntax
  20. jquery ajax call not firing