Javascript - What's Your Browser?

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > Java, Java Servlets, Java Script, & JSP

Javascript - What's Your Browser?

Graeme
Here is the code that i picked up from a Javascript book that will tell you wether you are using Firefox or Internet explorer.

obviously the (navigator.appName =="browser name") can be changed to different browsers.


CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 - Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
         <title>What's your browser?</title>
</head>
<body bgcolor="#FFFFFF">
<h2>
          

        <script language="Javascript1.5"
        type="text/javascript">
        <!-- Hide script from old browsers

        if (navigator.appName =="Firefox") {
        document.write("You are running a Firefox browser")
        }

        else {
        if (navigator.appName == "Microsoft Internet Explorer") {
        document.write("You are running Internet Explorer")
        }

        else {
        document.write("You're not using Internet Explorer or Firefox, maybe you should!")
        }
    }

        // End hiding script from old browsers -->

        </script>




</h2>
</body>
</html>

 

 

 


Reply

Tetraca
Wouldn't it be easier to do this server side with PHP? By the time you get to using javascript usually the browser matters less.

Reply

Saint_Michael
I have to concur especially since that most people disable javascript to begin with and doing it through php would be a lot cleaner and a lot smaller in the code size as well.

CODE
<?php echo $_SERVER["HTTP_USER_AGENT"]; ?>


That little one line of php cod and you just displayed the person's browser without making hte document look unorganized and large in document size

Reply

Graeme
Oh.

I'm working my way through Javascript at the moment.

Going to move onto Perl/PHP soon.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. browser - 159.22 hr back. (1)
  2. cache:yf48cs6s8mgj:www.trap17.com/index.php/adjusting-rows-cols-frames-frameset-using-javascript-not-working-firefox-3-not-working_t59255.html frameset rows javascript - 270.94 hr back. (1)
Similar Topics

Keywords : javascript, whats, browser,

  1. What's The Point Of Xhtml?
    (3)
  2. Need Help With Javascript Drag And Drop Script
    Having trouble with javascript drag and drop script. (2)
    hi, i have been trying to create a drag and drop menu for my new website, so that the navigation
    menu can be moved around the site. This is the code i have: CODE <html> <head>
    <title>Test run - Right click menu</title> <script
    type="text/javascript"> function coordinates(event) { if
    (event.button==2)   { var x=event.x; var y=event.y; }
    document.getElementById("element").style.left=x;
    document.getElementById("element").style.top=y;
    document.getElementById("eleme....
  3. Validating Javascript
    at the w3c (2)
    I have added a javascript behaviour to a small sample script and need to know how to get the
    javascript approved at the W3C. Here are the test results:
    http://validator.w3.org/check?uri=http%3A%...lidator%2F1.591 The validator doesn't like the
    onblur and onfocus events added to the input fileds for the script. Any ideas?....
  4. Firefox Hates Moveplayer
    Help me save my crashing browser. (5)
    I have a serious problem on my main PC. Firefox refuses to open. It goes directly to the crash
    report, listing the add-ons that failed on startup. I managed to launch it from the Run window into
    Safe Mode, and again it crashed immediately, but this time only listed one add-on: MovePlayer. The
    uninstall instructions I found require a Firefox capable of loading. I'm running Windows XP and
    have no listing for Move in my Add/Remove Programs dialog. What's my next step?....
  5. Video Play Like Youtube
    php, javascript source code need like player youtube (4)
    i need help for source code php or javascript... i want display video with a player like in
    youtube... please for help?....
  6. Google Chrome Reviews
    What do u think of Google's latest freeware browser? (22)
    I’m not suprised by this. Chrome auto updates itself without my consent (although I did consent for
    it to autoupdate in the EULA /tongue.gif" style="vertical-align:middle" emoid=":P" border="0"
    alt="tongue.gif" /> ) and the installation is so force (like not being able to customize anything…).
    Things like that are usually signs that the company’s attitude towards the costumer is less that
    perfect. Big corporations, that’s what you get. At least it’s open source, so it’ll probably fare
    well (if google doesn’t manage to tank the whole thing). It’s not like browsers that ....
  7. Whats Your Favorite Web Browser
    (13)
    1. Is Opera the fastest Browser around. 2. What do you think of googles new browser Chrome, does it
    beat Firefox 3? 3. Does anyone even use Internet explorer?....
  8. What's Your Outlook On The U.s. Economy?
    (as of September 2008) (0)
    I would like to ask the opinions of Trap17 to see where we think the market is going. The reason
    why I ask is because I'm sick of how the market is STILL on a downturn. Stocks are dropping and
    so are my mutual funds. I've been optimistic in having invested a bit more a couple of months
    ago, but recently I had to snag back those funds at a loss for emergency cash. The rest I've
    left invested, and as of today, I'm looking at over $1000 in losses. I'm wondering if
    anyone can advise me as to why I should keep my funds invested now or pull out and wa....
  9. Ur View On Cheaters
    Whats your view on cheaters? (11)
    Whats your opinion about cheaters? I, myself, often use cheats on games. I also use multihacks on
    multiplayer games, but I only use cheats vs. other cheaters, so it stays fair.. Im currently an
    active cheater in Wolfenstein - Enemy Territory. I only play in servers where an aimbot is allowed
    and i respect noncheaters (I used to play noncheat myself aswell). So, whats your view on cheaters?
    Do they suck, or do you respect them as long as they stay on their own territory? ~ Greetings,
    Accure....
  10. Opera Mini - A Great Mobile Phone Browser
    (1)
    Opera Mini is my favorite mobile web browser and it's in it 4.1th version. Get it here
    http://www.operamini.com In this newewst version of Opera Mini, the devs from Opera Software ASA
    offered us lots and lots of addons and new feaures to the bestest mobile browser in the world, like:
    Find in page - find text in page, with simple pressing on # and then * on the phone's keyboard
    and then entering the text you are searching for, and the app. will find the text with a speed of a
    computer browser. It's really useful when you are looking (eg.) for some informat....
  11. What's Your Favorite Mmorpg
    What's your favorite MMORPG (5)
    My Favorite is MapleStory, What's your favorite....
  12. Best Browser To Desighn Your Site To
    not much of a question but more like a statement (28)
    well since i started web desighning i've always used internet explore (why?) well when i first
    tried FF2, i wasn't a "web-designer" then so i didn't care much about css and htlm stuff, i
    din't like it and one of the reason was beacause a couple of the sites i visited wasnt firefox
    compatible. but anyways recently i was desighning a site for this community. so like two weeks ago i
    downloaded FF3 for testing purposes. in IE the site looked great but what i found was that in
    firefox the site was horible, as bad as they could come. so since firefox was better....
  13. Making My Own Browser
    Uhm...need a name (10)
    I am currently developing my own Web Browser and I need a name for it /biggrin.gif"
    style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> So if you got any good
    ideas please do post them /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0"
    alt="biggrin.gif" />....
  14. Simple Javascript And Password System
    How to protect your pages with password (9)
    The quickest way to get a password protection system up and running is to use a Prompt box in
    JavaScript that has a title like "Enter your Email Address". Only you and the relevant users know
    what the password should be, could even be one each, that can be sorted out at the next page then
    pass the "input" directly through the url by changing the .href, like
    http://www.iSource.net.nz/users/?leTmeIn= The page that then processes this should also check for
    the referring page, and three fails from an IP if you like the php (the next page): CODE
    <?php // processdo....
  15. What's A Cms?
    Know a little more about CMS. (32)
    The web community is getting bigger, and bigger everyday and the webdesigners are always looking for
    faster ways of creating and maintaining website with a very nice look. That's why CMS were
    created. A content management system (CMS) is a system used to manage the content of a Web
    site.Content management systems are deployed primarily for interactive use by a potentially large
    number of contributors. There are a lot of CMS, I currently use Joomla. Some examples of CMS are:
    Joomla Mambo e107 phpNuke Wordpress Xoops Drupal Those are just some of the CMS, a....
  16. Starcraft
    What's you view? (14)
    Starcraft, some people hate it, some people love it, some people don’t give a damn. But I’m just
    wondering, what’s your opinion about this game? What do you think has led this game to become so
    big, why do you keep playing it? What keeps you hooked onto this game, I probably won’t get a
    straightforward answer, but lately I’ve been thinking a lot about this and I want to see what you
    think. In my opinion, Starcraft is an amazing game, it's an old game, but it's a classic.
    People in Korea have like an entire channel dedicated to this game and hold tournaments, (T....
  17. Playing Flash Movies Without The One-click Activation: Simple Insertion Of Javascript
    (4)
    In the past year or two iternet explorer and other browsers have updated their coding platforms.
    The bad thing is that if you have any flash objects at all within your web page you have to hit the
    space bar or click on the flash object to activate it. Once you activate it, you then can interact
    with the object or the object will then play on the website. I dont like how you have to activate
    the flash player first to interact with it. here is the code to prevent that. Believe me people
    notice how much better the site is after you do this. put <script type="text/java....
  18. Free Hosts Whats Not To Love? Right..
    hate true some free hosts. (18)
    Well this is in general a complain to free hosts, not about this 1 keep that in mind havent used it
    yet /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> In general
    most free hosts are resellers or rairly use there own servers. Some full with adds even with simply
    html support full of spam. Now I host my own msql mysql php etc, for my projects on dictated
    servers. And I know that its heavy to host if its used a lot. But html I really hate a host if he
    advertises even on html pages I really think that is so retarded. And yust a way of ma....
  19. Sentences In Certain Books Which Change Your Life
    whats yours... (9)
    here are some sentences which i think may be very philosophic. from some books iv read. 1. if
    there's a person who you think worths you protecting life long,happy what he/she happies,sad
    what he/she sads,worry what he/she worries,then the life gets no regrets. 2. where make your heart
    calm,is your home. 3. making faults once,twice,third times etc has no relates with the destiny,the
    space and the time.it just because we have a certain weakness in the character. 4. people differ
    from each other.the day's going to rain so the birdss going to fly.some things we c....
  20. What's Your Fav Adventure Game?
    being adventurer.......fells being alive (29)
    i'm almost shure that is got to be Tomb
    raider!!!!!!!!!!!!!!!!???? ha???
    isn'it?? anyway that was the adventure game that i liked best, and one of the the games that
    managed to keep me busy for lots and lots of days were can i put it?? :::the adventuring spirit was
    never more alive in me like it was when playing Lara Croft's role anyway i told u what was
    mine, now it'd your turn........................
  21. What's Your Favourite Car?
    (148)
    The question is very simple: what's your favourite car? It includes suvs, vans, pickups and
    veicles similar to these. In my opinion the best and beautiful car is the Bentley Continental Flying
    Spur, I like very much all Bentley and generally english cars, but I think that the Flying Spur is a
    masterpiece fo the motor industry. And it's price is "only" 175000€ without optionals. Aniway
    very beautiful cars are also Ferrari 612 Scaglietti, BMW M5, Aston Martin DB9 and Range Rover. I
    place some photos of the Flying Spur. http://www.rsportscars.com/foto/08/flyingspu....
  22. Worth Of A 1935 Silver Certificate
    What's the worth? (6)
    I've had a 1935 Silver Certificate series 1935 F for while now, and I'm pondering its worth.
    It has no creases but it's well-worn. The number on the back lower right corner is 6407. Does
    that pertain to the value at all? Do any of you perhaps know the value of this?....
  23. What's Your Favourite Quote/es?
    Said what is it and it'll say who are you. (32)
    I ask simply what's your favourite quote/es. It can be of everyone but it's will better if
    it has been said by: - politics/kings/popes/presidents/generals - writers/philisophers - scientists
    So please don't write quotes of your grandmather (if it isn't Marie Curie /biggrin.gif'
    border='0' style='vertical-align:middle' alt='biggrin.gif' /> ) or drawn by a film (a book is OK).
    My favourite is the same that you can find in my signature but I like very much also these: - "Dieu
    est mon droit" ("God is my right") - "Dividi et impera" (about, "Split and rul....
  24. Whats the most recent movie you watched?
    (118)
    Whats the most recent movie you watched? And what did you think about it?....
  25. Javascript Slideshow Tutorial
    How to make a slideshow in JavaScript (4)
    JavaScript Slideshow Tutorial I'm going to show you how to make a impressive JavaScript
    slideshow. First, you're probably asking: why would I want to make a slideshow in JavaScript?
    There are a number of reasons. First, you don't have to build a new HTML page for each picture.
    Secondly, the page will load much faster because the of the compactness of the page. Ok let's
    get started with this example. First we'll add a <script> tag in the of our HTML
    document. In that script tag we will build the following: CODE      first = 1;      la....
  26. What's The Highest Known Processor Speed Achieved?
    HIGH SPEED PROCESSOR - FASTEST PROCESSOR (17)
    I was reading a personal web site a couple of months ago that was discussing the owner's
    experimentation with a 3.7 Ghz processor and liquid nitrogen cooling. If I recall correctly a speed
    in the area of 5 Ghz was reached, but I don't recall exactly. Have any of you seen this site
    and/or do you know where it is?....
  27. What's Your Favorite Game System - Console
    select one from each poll (181)
    i'm a computer game fan. it's expensive but more useful. it can be use for many purpose for
    your study and entertainment. much easier to use and most common to more people.....
  28. What's Your Favorite Kind Of Food?
    (86)
    Well, I'm from Argentina and I like eating meat alot, but I don't like spice food, or
    fattening like Fast food, but well when I'm hungry I'd eat anything, snaks are the worst,
    specially if there's cheese around...I like Italian alot I make pizza all the time, in fact last
    night I made two and they were pretty good. I like Japanese, because I like fish a lot too, Indian
    haven't had a lot so I'm not sure. The healthiest I thinks is, make your own with a little
    bit of everything.....
  29. What's Your Current Homepage?
    (101)
    What's your current homepage? I currently have Google as my home page. It's very fast and
    very good when you want to search something.....
  30. What browser do you use?
    (706)
    I use IE 6, enhanced from Win XP SP2. I want to see what other people use for browsers, and maybe
    start a discussion. This place needs more activity... /wink.gif" style="vertical-align:middle"
    emoid=";)" border="0" alt="wink.gif" />....

    1. Looking for javascript, whats, browser,

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for javascript, whats, browser,

*MORE FROM TRAP17.COM*
Similar
What's The Point Of Xhtml?
Need Help With Javascript Drag And Drop Script - Having trouble with javascript drag and drop script.
Validating Javascript - at the w3c
Firefox Hates Moveplayer - Help me save my crashing browser.
Video Play Like Youtube - php, javascript source code need like player youtube
Google Chrome Reviews - What do u think of Google's latest freeware browser?
Whats Your Favorite Web Browser
What's Your Outlook On The U.s. Economy? - (as of September 2008)
Ur View On Cheaters - Whats your view on cheaters?
Opera Mini - A Great Mobile Phone Browser
What's Your Favorite Mmorpg - What's your favorite MMORPG
Best Browser To Desighn Your Site To - not much of a question but more like a statement
Making My Own Browser - Uhm...need a name
Simple Javascript And Password System - How to protect your pages with password
What's A Cms? - Know a little more about CMS.
Starcraft - What's you view?
Playing Flash Movies Without The One-click Activation: Simple Insertion Of Javascript
Free Hosts Whats Not To Love? Right.. - hate true some free hosts.
Sentences In Certain Books Which Change Your Life - whats yours...
What's Your Fav Adventure Game? - being adventurer.......fells being alive
What's Your Favourite Car?
Worth Of A 1935 Silver Certificate - What's the worth?
What's Your Favourite Quote/es? - Said what is it and it'll say who are you.
Whats the most recent movie you watched?
Javascript Slideshow Tutorial - How to make a slideshow in JavaScript
What's The Highest Known Processor Speed Achieved? - HIGH SPEED PROCESSOR - FASTEST PROCESSOR
What's Your Favorite Game System - Console - select one from each poll
What's Your Favorite Kind Of Food?
What's Your Current Homepage?
What browser do you use?
advertisement



Javascript - What's Your Browser?



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE