Detect if JS is enabled

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stack
    New Member
    • Sep 2007
    • 40

    #1

    Detect if JS is enabled

    Hi all

    I 'm writing a small web app and I would like to know what ways there are to check if the users' browser has JS enabled. I know I can create a page that redirects to a different page using JS but I was wondering if there is a better way of doing it, e.g. do it from the same page.

    Thanks a lot
    stack
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    Have a look at this ;)

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      I think that's exactly the kind of thing he wanted to avoid.

      To detect if JavaScript is enabled, just put the code in script tags. Make it unobtrusive, i.e. not inline and the code will run if JavaScript is enabled and will be ignored if it's disabled.

      Comment

      • stack
        New Member
        • Sep 2007
        • 40

        #4
        Thank you both for your answers. Yes acoder that was what I was trying to avoid :-). I don't know if you 're using gmail. If you try to login to your account and JS is disabled, the page won't load. This is what I would like to accomplish if possible.

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          Add the page functionality using JavaScript (create elements dynamically) and a noscript message informing the user that they must enable JavaScript to use the page.

          Comment

          Working...