-3

Hello I was wondering if the noscript tag could be used in a php action? I want the user to be stoped if the action finds that the user has no java script enabled

Jake Garza
  • 43
  • 3
  • 6
  • Yes, you can do so :) – prava Aug 19 '14 at 05:13
  • Not entirely sure this qualifies as a duplicate. The OP did not seem to be aware that PHP was not the type of script that could be affected before asking, nor does the referenced page mention the noscript tag. Just my 2 cents... – Jeff Clayton Aug 19 '14 at 05:29
  • @Jeff No, the duplicate isn't an exact duplicate of this exact question. But the duplicate explains some fundamental concept which renders this question here obsolete and/or answers it. – deceze Aug 19 '14 at 06:09

1 Answers1

2

Noscript is a standard html tag. PHP occurs before html is executed so the page will stop and not get to the closing portion of the noscript tag at all. So no that will not work.

Jeff Clayton
  • 7,053
  • 1
  • 31
  • 36
  • Is there a way to make sure the user has java script enabled? because they can just enable it then disable once at the page – Jake Garza Aug 19 '14 at 05:15
  • @JayGarza JavaScript is evaluated client-side, which is beyond your control. You cannot enforce what is done in the user's own browser; only what happens on your server before you send them the page. – Amber Aug 19 '14 at 05:15
  • One way I can imagine being certain that the user has javascript enabled when they arrive at your page is to have a form post to it using javascript. The noscript tag can be used on the previous page saying 'you must enable javascript to proceed' -- so it falls upon the user but that is really how it works, user controlled. – Jeff Clayton Aug 19 '14 at 05:18
  • @Jay Have a page for visitors without Javascript, saying something like "You need Javascript to use this page". Embed Javascript in this page which then loads the actual content you want to display. People without JS will see the "Sorry" page, people with will see the content get loaded. – deceze Aug 19 '14 at 05:20
  • You could even go so far as to document.write every part of your pages. Then nothing but what is in the noscript tags shows at all. People rarely do that except in cases like when they are using a javascript obfuscation program like ioncube or just has a ton of code, like the gmail site. – Jeff Clayton Aug 19 '14 at 05:23