Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computing > NZ Computing > javascript Alert() on Firefox - No Sound

Reply
Thread Tools

javascript Alert() on Firefox - No Sound

 
 
JohnO
Guest
Posts: n/a
 
      04-03-2008
Hi All,

If I embed this in a web page, I get a popup window that should make
the windows beep sound. This works in InternetExploder, but on FireFox
I get no sound. Any idea why that would be?

<script>
alert("let there be sound");
</script>

TIA,
JohnO
 
Reply With Quote
 
 
 
 
Ralph Fox
Guest
Posts: n/a
 
      04-03-2008
On Wed, 2 Apr 2008 20:47:08 -0700 (PDT), in message <52f114b0-de67-4887-805e->,
JohnO wrote:

> If I embed this in a web page, I get a popup window


Which you do, of course.

> that should make
> the windows beep sound.


Er, _why_ should it make the windows beep sound?


> This works in InternetExploder, but on FireFox
> I get no sound. Any idea why that would be?


1. IE uses the Windows MessageBox API to show the pop-up.
The MessageBox API, as well as showing a pop-up, also makes a sound.

2. Firefox does not use the Windows MessageBox API for this.

3. There is no requirement to make a sound. This is simply one of the
differences between browsers.


> <script>
> alert("let there be sound");
> </script>
>
> TIA,
> JohnO



--
Cheers,
Ralph

 
Reply With Quote
 
 
 
 
JohnO
Guest
Posts: n/a
 
      04-03-2008
On Apr 3, 9:00*pm, Ralph Fox <-rf-...@-.invalid> wrote:
> On Wed, 2 Apr 2008 20:47:08 -0700 (PDT), in message <52f114b0-de67-4887-805e-2e8495466...@s8g2000prg.googlegroups.com>,
>
> JohnO wrote:
> > If I embed this in a web page, I get a popup window

>
> Which you do, of course.
>
> > that should make
> > the windows beep sound.

>
> Er, _why_ should it make the windows beep sound?
>
> > This works in InternetExploder, but on FireFox
> > I get no sound. Any idea why that would be?

>
> 1. *IE uses the Windows MessageBox API to show the pop-up.
> * * The MessageBox API, as well as showing a pop-up, also makes a sound.
>
> 2. *Firefox does not use the Windows MessageBox API for this.
>
> 3. *There is no requirement to make a sound. *This is simply one of the
> * * differences between browsers.
>
> > <script>
> > alert("let there be sound");
> > </script>

>
> > TIA,
> > JohnO

>
> --
> Cheers,
> Ralph


Ok, I can get around it by detecting the browser:
<SCRIPT>
var browser = navigator.appName;
if (browser=="Netscape")
{
java.awt.Toolkit.getDefaultToolkit().beep();
}
alert("Error Message");
</SCRIPT>
 
Reply With Quote
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      04-03-2008
In article
<61ab2ff4-6946-464c-9433->, JohnO
did write:

> if (browser=="Netscape")


Yuk. Please, check directly for the functionality you need, not for some
purely informational name.
 
Reply With Quote
 
JohnO
Guest
Posts: n/a
 
      04-03-2008
On Apr 4, 11:38 am, Lawrence D'Oliveiro <l...@geek-
central.gen.new_zealand> wrote:
> In article
> <61ab2ff4-6946-464c-9433-1b36814ba...@i12g2000prf.googlegroups.com>, JohnO
> did write:
>
> > if (browser=="Netscape")

>
> Yuk. Please, check directly for the functionality you need, not for some
> purely informational name.


Go on then, explain exactly how to do that, please.

 
Reply With Quote
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      04-03-2008
In article
<8ab0c28f-08f1-410e-95ee->, JohnO
did write:

> On Apr 4, 11:38 am, Lawrence D'Oliveiro <l...@geek-
> central.gen.new_zealand> wrote:
>
>> In article
>> <61ab2ff4-6946-464c-9433-1b36814ba...@i12g2000prf.googlegroups.com>,
>> JohnO did write:
>>
>> > if (browser=="Netscape")

>>
>> Yuk. Please, check directly for the functionality you need, not for some
>> purely informational name.

>
> Go on then, explain exactly how to do that, please.


Check for the existence of those objects before trying to use them.
 
Reply With Quote
 
JohnO
Guest
Posts: n/a
 
      04-04-2008
On Apr 4, 12:49*pm, Lawrence D'Oliveiro <l...@geek-
central.gen.new_zealand> wrote:
> In article
> <8ab0c28f-08f1-410e-95ee-32a2b2425...@i12g2000prf.googlegroups.com>, JohnO
> did write:
>
> > On Apr 4, 11:38 am, Lawrence D'Oliveiro <l...@geek-
> > central.gen.new_zealand> wrote:

>
> >> In article
> >> <61ab2ff4-6946-464c-9433-1b36814ba...@i12g2000prf.googlegroups.com>,
> >> JohnO did write:

>
> >> > if (browser=="Netscape")

>
> >> Yuk. Please, check directly for the functionality you need, not for some
> >> purely informational name.

>
> > Go on then, explain exactly how to do that, please.

>
> Check for the existence of those objects before trying to use them.


But it is not so much exisetnce of objects that I am interested in.
All the platforms support the alert() method, but not all of them make
a sound, and it doesn't seem to be documented which do. I have
determined that FF does not and IE does at the moment. So it appears
the test is about the browser not the objects.
 
Reply With Quote
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      04-04-2008
In article
<3548e1a2-793f-418a-88ef->, JohnO
did write:

> On Apr 4, 12:49Â*pm, Lawrence D'Oliveiro <l...@geek-
> central.gen.new_zealand> wrote:
>> In article
>> <8ab0c28f-08f1-410e-95ee-32a2b2425...@i12g2000prf.googlegroups.com>,
>> JohnO did write:
>>
>> > On Apr 4, 11:38 am, Lawrence D'Oliveiro <l...@geek-
>> > central.gen.new_zealand> wrote:

>>
>> >> In article
>> >> <61ab2ff4-6946-464c-9433-1b36814ba...@i12g2000prf.googlegroups.com>,
>> >> JohnO did write:

>>
>> >> > if (browser=="Netscape")

>>
>> >> Yuk. Please, check directly for the functionality you need, not for
>> >> some purely informational name.

>>
>> > Go on then, explain exactly how to do that, please.

>>
>> Check for the existence of those objects before trying to use them.

>
> But it is not so much exisetnce of objects that I am interested in.
> All the platforms support the alert() method, but not all of them make
> a sound, and it doesn't seem to be documented which do. I have
> determined that FF does not and IE does at the moment. So it appears
> the test is about the browser not the objects.


But you are calling specific objects to get the sound, are you not?
Therefore, test for those objects.
 
Reply With Quote
 
JohnO
Guest
Posts: n/a
 
      04-04-2008
On Apr 4, 4:20 pm, Lawrence D'Oliveiro <l...@geek-
central.gen.new_zealand> wrote:
> In article
> <3548e1a2-793f-418a-88ef-b2cf5c838...@s19g2000prg.googlegroups.com>, JohnO
> did write:
>
>
>
> > On Apr 4, 12:49 pm, Lawrence D'Oliveiro <l...@geek-
> > central.gen.new_zealand> wrote:
> >> In article
> >> <8ab0c28f-08f1-410e-95ee-32a2b2425...@i12g2000prf.googlegroups.com>,
> >> JohnO did write:

>
> >> > On Apr 4, 11:38 am, Lawrence D'Oliveiro <l...@geek-
> >> > central.gen.new_zealand> wrote:

>
> >> >> In article
> >> >> <61ab2ff4-6946-464c-9433-1b36814ba...@i12g2000prf.googlegroups.com>,
> >> >> JohnO did write:

>
> >> >> > if (browser=="Netscape")

>
> >> >> Yuk. Please, check directly for the functionality you need, not for
> >> >> some purely informational name.

>
> >> > Go on then, explain exactly how to do that, please.

>
> >> Check for the existence of those objects before trying to use them.

>
> > But it is not so much exisetnce of objects that I am interested in.
> > All the platforms support the alert() method, but not all of them make
> > a sound, and it doesn't seem to be documented which do. I have
> > determined that FF does not and IE does at the moment. So it appears
> > the test is about the browser not the objects.

>
> But you are calling specific objects to get the sound, are you not?
> Therefore, test for those objects.


The object that I am interested in is the alert() method of the
javascript Window object and that is there in all cases, so testing
for it's existence doesn't help me. My issue is that the alert()
method on non IE browsers is silent so I need to know what the browser
is, not whether the object exists.

Do you mean testing for the existence of the java objects? Interesting
but probably not the solution as they could be there whether the
alert() method is silent or not.

Anyway, how do you test for existence of an object? Reference it and
catch an exception if it is not there?

 
Reply With Quote
 
Hamish Campbell
Guest
Posts: n/a
 
      04-04-2008
On Apr 4, 1:13*pm, JohnO <johno1...@gmail.com> wrote:
> On Apr 4, 12:49*pm, Lawrence D'Oliveiro <l...@geek-
>
>
>
>
>
> central.gen.new_zealand> wrote:
> > In article
> > <8ab0c28f-08f1-410e-95ee-32a2b2425...@i12g2000prf.googlegroups.com>, JohnO
> > did write:

>
> > > On Apr 4, 11:38 am, Lawrence D'Oliveiro <l...@geek-
> > > central.gen.new_zealand> wrote:

>
> > >> In article
> > >> <61ab2ff4-6946-464c-9433-1b36814ba...@i12g2000prf.googlegroups.com>,
> > >> JohnO did write:

>
> > >> > if (browser=="Netscape")

>
> > >> Yuk. Please, check directly for the functionality you need, not for some
> > >> purely informational name.

>
> > > Go on then, explain exactly how to do that, please.

>
> > Check for the existence of those objects before trying to use them.

>
> But it is not so much exisetnce of objects that I am interested in.
> All the platforms support the alert() method, but not all of them make
> a sound, and it doesn't seem to be documented which do. I have
> determined that FF does not and IE does at the moment. So it appears
> the test is about the browser not the objects.- Hide quoted text -
>
> - Show quoted text -


If the object doesn't exist then code execution will fail, so it's a
good idea to check. The point is not to assume. You want to do
something like this:

<script language="javascript">
function alertWithBeep(s) {
if( navigator.appName=="Netscape" && typeof(java)=="object") {
java.awt.Toolkit.getDefaultToolkit().beep();
}
alert(s);
}

// test!
alertWithBeep("HI!");
</script>

So it only tries to 'beep' if we think the browser is Netscape and the
java object exists.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mobo On-Board Sound + PCI Sound Card? John E Computer Support 24 10-01-2007 05:53 AM
Playing sound through non default sound card dkga_dkga@yahoo.com Java 0 03-05-2006 04:38 AM
Sound Quality In Sound API Luc The Perverse Java 4 10-31-2005 04:36 AM
No sound. Yellow exclamation by" Windows sound system". =?Utf-8?B?VGFueWE=?= MCSE 2 10-26-2003 07:44 PM
Geforce 4 MX 440 Sound Prob (thats right, sound) Matthew Morrison Computer Support 2 07-29-2003 01:23 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57