Results 1 to 6 of 6

Thread: Script sound notification not working on mozila firefox

  1. #1
    Join Date
    Aug 2013
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Script sound notification not working on mozila firefox

    This chat sound notification script works on Internet Explorer, Safari and google chrome.
    But does not work on mozila firefox. can someone help me to fix that or an alternative that can work in all browsers
    Code:
    <html><head></head>
    
    
        <script type="text/javascript">
            var soundObject = null;
            function PlaySound() {
                if (soundObject != null) {
                    document.body.removeChild(soundObject);
                    soundObject.removed = true;
                    soundObject = null;
                }
                soundObject = document.createElement("embed");
                soundObject.setAttribute("src", "notify.wav");
                soundObject.setAttribute("hidden", true);
                soundObject.setAttribute("autostart", true);
                document.body.appendChild(soundObject);
            }
        
       
    </script>
    <body>
        <embed src="notify.wav" autostart=false width=0 height=0 id="boom"
        enablejavascript="true">
    </form method="post" action="dd.php">
    <input name="message" type="text"   placeholder="Chatting" />
    <input name="reciever" type="hidden" value=""><br>
    
    <input name="submit" type="submit" value=Chat3 id="post_button" onClick="PlaySound()"/>
    </form>
    
    
    </body>
    </html>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The fox doesn't like width=0 height=0. Change the embed tag to:

    Code:
        <embed src="notify.wav" autostart=false hidden=true id="boom"
        enablejavascript="true">
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2013
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It seems not to work. it says additional plugin is required to display all the media on this page.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    OK, well that can happen. The .wav format generally uses QuickTime - though it could use other plugins. If QT isn't installed and there's no other plugin installed that can take care of it for you, you will get that message. Something similar will happen in any other browser. If that browser has no plugin installed that can handle the embed, then it will not work and there may or may not be a notification. Worked fine here in Firefox once I changed the the embed tag as I described.

    You could use an HTML 5 audio tag, but that's complicated and you would still need a backup for browsers that don't support it or that don't support .wav in it (IE).

    Here it is without backup. When I get some more time I'll show you how to do it with backup, either browser sniffing, or feature detection. The latter if that's feasible:

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
    #thesound {
    	position: absolute;
    	top: -3000px;
    	left: -3000px;
    }
    </style>
    </head>
    <body>
    <audio id="thesound">
    <source src="notify.wav" type="audio/x-wav">
    </audio>
    <form method="post" action="dd.php" onsubmit="return false">
    <input name="message" type="text"   placeholder="Chatting" />
    <input name="reciever" type="hidden" value=""><br>
    
    <input name="submit" type="submit" value=Chat3 id="post_button" onClick="document.getElementById('thesound').play()"/>
    </form>
    </body>
    </html>
    See how that works in the fox, it might still not, if your copy of Firefox doesn't support the tag, or doesn't have a codec for .wav, it will still fail.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    OK, try this out:

    notify.zip
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Aug 2013
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    its working now. Thank you so much

Similar Threads

  1. Scheuer Toggle Sound Script II FireFox Problem
    By datachem in forum JavaScript
    Replies: 32
    Last Post: 04-10-2013, 08:18 PM
  2. Script not working using Firefox
    By tricky in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 10-25-2010, 03:03 PM
  3. Script working/not working in Firefox
    By SawnDiddle in forum JavaScript
    Replies: 2
    Last Post: 03-27-2008, 07:23 AM
  4. Tab Script not working in Firefox
    By FMJEFF in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 12-30-2006, 08:36 PM
  5. SOUND for Firefox?
    By Wedgy in forum JavaScript
    Replies: 30
    Last Post: 11-25-2005, 12:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •