1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Detect JavaScript through PHP?

Discussion in 'PHP' started by Tony Brar, Nov 11, 2012.

  1. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #21
    I agree, sometimes i don't read all of the lines but i totaly disagree with you that the most logical way is cookies. But i'm not starting a discussion as the TS already has his answer in differend ways.
     
    EricBruggema, Nov 17, 2012 IP
  2. abhirampathak3

    abhirampathak3 Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #22
    Well I would recommend an advanced system of ajax for best confirmation but if you want to keep it simple the following script will do the job.

    $v=get_browser(null,true);
    $javascript=$v['javascript'];
    unset($v);
    if ($javascript) {
    echo 'Javascript is enabled';
    } else {
    echo 'Javascript is disabled';
    }
     
    abhirampathak3, Nov 19, 2012 IP
  3. Tony Brar

    Tony Brar Active Member

    Messages:
    220
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    75
    #23
    Would that detect if JavaScript is enabled or just if it is supported?

    Thanks,
    -Tony
     
    Tony Brar, Nov 19, 2012 IP
  4. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #24
    Supported :)
     
    EricBruggema, Nov 20, 2012 IP
  5. Tony Brar

    Tony Brar Active Member

    Messages:
    220
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    75
    #25
    I'm just going to add a message in a <noscript> tag-'Many functions of this site require JavaScript.'

    Thanks for all of the feedback.
    -Tony
     
    Tony Brar, Nov 20, 2012 IP
  6. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #26
    You're still stressing over this? Show me one visitor on your web site with JavaScript not enabled and I will show you a visitor that can't use 95% of the web sites out there... Don't spend time focusing on little minor problems that you may never encounter. Appeal to the masses NOT the possible minority of the minorities.
     
    NetStar, Nov 20, 2012 IP
  7. Tony Brar

    Tony Brar Active Member

    Messages:
    220
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    75
    #27
    I know.
    Adding noscript is easy.

    -Tony
     
    Tony Brar, Nov 20, 2012 IP
  8. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #28
    Oh and ps. one of the stupidest things I've heard was to use Ajax (which is Asynchronous JavaScript and XML) to detect if JavaScript is enabled. Ajax IS a method of how you use JAVASCRIPT. Which means you use...JAVASCRIPT.
     
    NetStar, Nov 20, 2012 IP
  9. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #29
    @NetStar, that's realy stupid indeed! where did you hear that? :p
     
    EricBruggema, Nov 20, 2012 IP