Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Browser detection and ..

    Hi everyone. I will write shortly, because I dont know english good..
    So I need script, which will detect users browser, and if browser will be IE, then show some link in content, if browser is FireFox or Opera, then hide that link. Link looks like:

    Code:
    <tr>
       <td align='center' valign='top'><a href='/' target='_blank'>link</a></td>
    </tr>
    Thanks to all for any help!

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,471
    Thanks
    0
    Thanked 634 Times in 624 Posts
    Use HTML - no Javascript required.

    Code:
    <!--[if IE]>
    <p>This content will appear in IE.</p>
    <[endif]-->
    <--[if !IE]-->
    <p>This content will appear in all browsers except IE.</p>
    <--[endif]-->
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    New Coder
    Join Date
    Jan 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Stephen, thanks very much for help. A little problem, in IE when opening page this is showing: <[endif]-->

    In FF and Opera works good.

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Stephen was close. He left out a >. Try this
    Code:
    <!--[if IE]>
    <p>You are using IE</p>
    <![endif]-->
    <!--[if !IE]>-->
    <p>You are not using IE</p>
    <!--<![endif]-->
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New Coder
    Join Date
    Jan 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks!!!!


  •  

    Posting Permissions

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