Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Javascript detection

Javascript detection

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptasp-nethelptutorial
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rojan Gh
    wrote on last edited by
    #1

    My Asp.net 2.0 pages need the client browser to have JavaScript enabled, and this must be detected immediately after the Page load so if the browser does not support the javascript I will redirect the user to some other page, but I don't know how to do that. In addition, the Request.Browser.JavaScript and Request.Browser.JScript do not work when the browser supports the JavaScript but the user has disabled it! Please help me detect if the user's browser is JavaScript enabled or not.

    Sojaner!

    G 1 Reply Last reply
    0
    • R Rojan Gh

      My Asp.net 2.0 pages need the client browser to have JavaScript enabled, and this must be detected immediately after the Page load so if the browser does not support the javascript I will redirect the user to some other page, but I don't know how to do that. In addition, the Request.Browser.JavaScript and Request.Browser.JScript do not work when the browser supports the JavaScript but the user has disabled it! Please help me detect if the user's browser is JavaScript enabled or not.

      Sojaner!

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Use Javascript in the onload event of the page to redirect to one page, and a meta tag to redirect to another page.

      --- Year happy = new Year(2007);

      R 1 Reply Last reply
      0
      • G Guffa

        Use Javascript in the onload event of the page to redirect to one page, and a meta tag to redirect to another page.

        --- Year happy = new Year(2007);

        R Offline
        R Offline
        Rojan Gh
        wrote on last edited by
        #3

        What kind of meta tag? And also I want the user to stay at the current page if his browser is javascript enabled and redirect him if his browser is javascript disabled.

        Sojaner!

        G 1 Reply Last reply
        0
        • R Rojan Gh

          What kind of meta tag? And also I want the user to stay at the current page if his browser is javascript enabled and redirect him if his browser is javascript disabled.

          Sojaner!

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          Sojaner wrote:

          What kind of meta tag?

          http-equiv="refresh"

          Sojaner wrote:

          And also I want the user to stay at the current page if his browser is javascript enabled and redirect him if his browser is javascript disabled.

          It might be possible, but there is no obvious way to do it. The problem with that is that it's impossible to detect if Javascript is disabled, you can only detect if it's enabled. If it's disabled, there is nothing that you can use to do the detecting. -- modified at 2:52 Friday 19th January, 2007

          --- Year happy = new Year(2007);

          R 1 Reply Last reply
          0
          • G Guffa

            Sojaner wrote:

            What kind of meta tag?

            http-equiv="refresh"

            Sojaner wrote:

            And also I want the user to stay at the current page if his browser is javascript enabled and redirect him if his browser is javascript disabled.

            It might be possible, but there is no obvious way to do it. The problem with that is that it's impossible to detect if Javascript is disabled, you can only detect if it's enabled. If it's disabled, there is nothing that you can use to do the detecting. -- modified at 2:52 Friday 19th January, 2007

            --- Year happy = new Year(2007);

            R Offline
            R Offline
            Rojan Gh
            wrote on last edited by
            #5

            But I know a website that is written in CGI and immediately after you enter the main page, it detects that you javascript is disabled and redirects you to some html page that tells you to enabled the javascript! I don't care about the difference between detecting that the javascript is disabled or it is enabled! I just want to make the user, enable the javascript, when he enters my page! For example, I use Firefox 2.0, and I have installed an add-on name "No Script" that blocks the javascript scripts until you allow them to run, but when I'm debugging my code, using Firefox, my code could not detect that the javascript scripts are blocked! Although the

            tags work correctly when this add-on block the scripts, but the Request.Browser.Javascript is true!

            Sojaner!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups