How to display contents only in FireFox browser?

Discussion in 'JavaScript' started by webgames247, Oct 15, 2017.

  1. #1
    like the title said. I only want to display certain contents in for FF browser user.

    something like this...

    if($.browser.mozilla){
    // do something

    }


    Thanks advance
     
    Last edited: Oct 15, 2017
    webgames247, Oct 15, 2017 IP
  2. denis bayly

    denis bayly Well-Known Member

    Messages:
    110
    Likes Received:
    29
    Best Answers:
    6
    Trophy Points:
    105
    #2

    No, that is a very, very silly idea. :rolleyes:

    coothead
     
    denis bayly, Oct 15, 2017 IP
  3. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,291
    Likes Received:
    1,698
    Best Answers:
    31
    Trophy Points:
    475
    #3
    qwikad.com, Oct 16, 2017 IP
  4. phpmillion

    phpmillion Member

    Messages:
    145
    Likes Received:
    11
    Best Answers:
    4
    Trophy Points:
    45
    #4
    I'm afraid it won't work, no matter if you do browser check using server-side (like PHP) or stuff like JavaScript. Let me explain...

    If you use PHP-like stuff to check user agent, it can be faked with single line of extra code. This needs to be done by user with PHP skills, however. In short, he will need to write a super-simple content parser which can set any fake user agent user wants. I could write such a script in less than 5 minutes. Of course, "dumb" user won't be able to do that, but some browsers allow to set any other user agent via browser settings. Or user may use some plugin to do that.

    If you use JavaScript validation, and then hide/unhide some HTML elements on page, these elements will still be there and can be viewed at any time by clicking CTRL+U (or whatever shortcut you use to view page source).
     
    phpmillion, Oct 26, 2017 IP