Detecting Mozilla using JavaScript

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved

Join Date: Aug 2009
Posts: 12
Reputation: Terry56 is an unknown quantity at this point 
Solved Threads: 0
Terry56 Terry56 is offline Offline
Newbie Poster

Detecting Mozilla using JavaScript

 
0
  #1
Sep 1st, 2009
Hi to all,
hope you all will be fine, I use a script to detect IE and Mozilla but the problem is when i run it in the firefox it won't work then i find out the name of navigator and it shows Netscape. How i detect Mozilla here is my scrip, it works fine but how i detect mozilla thanks. If i check that _app=='Mozilla' it shows unsupported browser. Thank you. One thing more is it required to enclose my script in <!-- -->.

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd">
  3. <html lang="en">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta http-equiv="Content-Script-Type" content="text/javascript">
  7. <title></title>
  8. </head>
  9. <body>
  10. <script language="Javascript" type="text/javascript">
  11. document.writeln(navigator.appName);
  12. if(!navigator.javaEnabled()){
  13. alert('Enable your java to expeirience this java enhanced page or\n try install it...');
  14. location.replace('http://java.sun.com');
  15. window.open('instructionsforintallingjava.html');
  16. }
  17. else{
  18. var _app = navigator.appName;
  19.  
  20. if (_app == 'Netscape') {
  21. document.write('<embed code="CapturePlayback1.class"',
  22. 'width="200"',
  23. 'height="200"',
  24. 'archive="CapturePlayback1.jar"',
  25. 'mayscript="true"',
  26. 'pluginspage="http://java.sun.com/products/plugin/index.html#download"',
  27. 'type="application/x-java-applet;version=1.6">');
  28.  
  29. }
  30. else if (_app == 'Microsoft Internet Explorer') {
  31. document.write('<OBJECT ',
  32. 'classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"',
  33. 'codebase="http://java.sun.com/update/1.6.0/jinstall-6u13-windows-i586.cab#Version=1,5,0,0"',
  34. 'width="200"',
  35. 'height="200">',
  36. '<PARAM name="code" value="CapturePlayback1.class">',
  37. '<PARAM name="archive" value="CapturePlayback1.jar">',
  38. '<PARAM name="name" value="BrightAmericans">',
  39. '<PARAM name="mayscript" value="true">',
  40. '</OBJECT>');
  41. }
  42. else {
  43. document.write('<p>Sorry, unsupported browser.</p>');
  44. }
  45.  
  46. }
  47. </script>
  48.  
  49. <noscript>
  50.  
  51. Enabled javascript please
  52.  
  53. </noscript>
  54.  
  55. </body>
  56. </html>
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 318
Reputation: Thirusha is an unknown quantity at this point 
Solved Threads: 51
Thirusha's Avatar
Thirusha Thirusha is offline Offline
Posting Whiz

Re: Detecting Mozilla using JavaScript

 
0
  #2
Sep 1st, 2009
I could be wrong but i dont think there is one, as far as I know, when u use
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. navigator.appName
, the result in Mozilla will be Netscape.

So if the code checks for Netscape it would work in Firefox
Life... Is a Moment
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 12
Reputation: Terry56 is an unknown quantity at this point 
Solved Threads: 0
Terry56 Terry56 is offline Offline
Newbie Poster

Re: Detecting Mozilla using JavaScript

 
0
  #3
Sep 2nd, 2009
Hi ,
Hope you will be fine. Oooooops thanks yup i think you are right, because after changing to netscape it works on Mozilla firefox
Thank you
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 318
Reputation: Thirusha is an unknown quantity at this point 
Solved Threads: 51
Thirusha's Avatar
Thirusha Thirusha is offline Offline
Posting Whiz

Re: Detecting Mozilla using JavaScript

 
0
  #4
Sep 2nd, 2009
Pleasure
Life... Is a Moment
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 180
Reputation: codejoust is an unknown quantity at this point 
Solved Threads: 19
codejoust's Avatar
codejoust codejoust is offline Offline
Junior Poster

Re: Detecting Mozilla using JavaScript

 
0
  #5
Sep 6th, 2009
Don't forget to mark the thread as solved.
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 12
Reputation: Terry56 is an unknown quantity at this point 
Solved Threads: 0
Terry56 Terry56 is offline Offline
Newbie Poster

Re: Detecting Mozilla using JavaScript

 
0
  #6
Sep 7th, 2009
Hi,
How i mark my thread solved
Thank you

Sorry for asking its so simple just click on Mark as Solved
Last edited by Terry56; Sep 7th, 2009 at 12:57 am.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



Tag cloud for JavaScript / DHTML / AJAX
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC