PHP and/or Javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • willl69

    PHP and/or Javascript

    Hi,

    I was wondering if anyone knows of a way to test if javascript is on with
    PHP or any other language. I need to test if it is enabled and if it
    isnt, redirect to another page. Any help greatly appreciated.

    Cheers

    Will

  • Tony

    #2
    Re: PHP and/or Javascript

    willl69 wrote:[color=blue]
    > Hi,
    >
    > I was wondering if anyone knows of a way to test if javascript is on
    > with PHP or any other language. I need to test if it is enabled and
    > if it isnt, redirect to another page. Any help greatly appreciated.[/color]

    Only Javascript can test if Javascript is enabled.

    Given that, you would be much better off asking this in comp.lang.javas cript

    Actually, you would be even better off searching the forum first, since this
    exact question has been discussed at least twice in the past month. There
    were a few decent solutions proposed - you could take your pick!

    --
    Tony Garcia
    Web Right! Development


    Comment

    • petermichaux@yahoo.com

      #3
      Re: PHP and/or Javascript

      Hi Will,

      If you want to test if Javascript is on in your browser make a file
      called test.html with the following



      <html>
      <head>
      </head>
      <body>
      <p>
      <script language="javas cript" type="text/javascript">
      <!--
      document.write( "javascript is enabled in your browser. In your browser
      preferences try turning javascript off and reload this page.")
      // -->
      </script>
      <noscript>
      javascript and is not enabled in your browser. In your browser
      preferences try turning javascript on and reload this page.
      </noscript>
      </p>
      </body>
      </html>

      So you do not need to use php to do the check. Like Tony said and the
      above example shows, just use Javascript.

      You might want to check out this page I put together. Download the
      technologyExamp les.zip files and read the readme. It is rough but
      should help you out if you want to test other technology out (xml,
      xslt,...).



      -Peter

      Comment

      • steve

        #4
        Re: PHP and/or Javascript

        "" wrote:[color=blue]
        > Hi,
        >
        > I was wondering if anyone knows of a way to test if javascript
        > is on with
        > PHP or any other language. I need to test if it is enabled
        > and if it
        > isnt, redirect to another page. Any help greatly appreciated.
        >
        > Cheers
        >
        > Will[/color]

        Check out these newsgroup archives..





        The third ulr should work for you.

        --
        Posted using the http://www.dbforumz.com interface, at author's request
        Articles individually checked for conformance to usenet standards
        Topic URL: http://www.dbforumz.com/PHP-Javascri...ict236576.html
        Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=821262

        Comment

        • Colin McKinnon

          #5
          Re: PHP and/or Javascript

          willl69 wrote:
          [color=blue]
          > Hi,
          >
          > I was wondering if anyone knows of a way to test if javascript is on with
          > PHP or any other language. I need to test if it is enabled and if it
          > isnt, redirect to another page. Any help greatly appreciated.
          >
          > Cheers
          >
          > Will[/color]

          It'd be a lot easier to redirect using javascript - that way if it's not on
          you'll know about it.

          C.

          Comment

          • JDS

            #6
            Re: PHP and/or Javascript

            On Wed, 29 Jun 2005 20:12:24 -0700, petermichaux wrote:
            [color=blue]
            > So you do not need to use php to do the check. Like Tony said and the[/color]

            In fact, not only do you not *need* PHP to do the check, you really
            *can't* use PHP to do the check!

            Your code example is the only reliable way to check if JS is "on"

            --
            JDS | jeffrey@example .invalid
            | http://www.newtnotes.com
            DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

            Comment

            • Tony

              #7
              Re: PHP and/or Javascript

              Colin McKinnon wrote:[color=blue]
              > willl69 wrote:
              >[color=green]
              >> Hi,
              >>
              >> I was wondering if anyone knows of a way to test if javascript is on
              >> with PHP or any other language. I need to test if it is enabled and
              >> if it isnt, redirect to another page. Any help greatly appreciated.
              >>
              >> Cheers
              >>
              >> Will[/color]
              >
              > It'd be a lot easier to redirect using javascript - that way if it's
              > not on you'll know about it.[/color]

              And it doesn't rely on <noscript>, which doesn't always work.

              --
              Tony Garcia
              Web Right! Development


              Comment

              Working...