Skip to main content

Timeline for answer to Check if JavaScript is enabled with PHP by Andy

Current License: CC BY-SA 3.0

Post Revisions

10 events
when toggle format what by license comment
Jun 20, 2023 at 16:05 comment added Rusty This doesn't answer the OPs question so unfortunately can't upvote it, however it's a really nice little trick which I hadn't thought of and and I wanted to say thank you for this @Andy
S Jan 3, 2017 at 19:51 history suggested Mahdi Jazini CC BY-SA 3.0
W3c Standard: noscript tags with style tags should be in head tag
Jan 3, 2017 at 19:00 review Suggested edits
S Jan 3, 2017 at 19:51
Jan 3, 2017 at 18:41 comment added Mahdi Jazini as @Clément said (it does not validate W3C's HTML5 standards) but if you move the code to the head tag, it will be a validate W3C's HTML5 standard and you can use the style in the noscript tag without any problem :)
Sep 14, 2016 at 22:23 comment added Ben Visness It is valid HTML5 to put a <style> tag inside a <noscript> tag, as long as the <noscript> tag is in the <head>. See w3.org/TR/html5/scripting-1.html#the-noscript-element
Jul 8, 2015 at 21:21 comment added Steve This is great if you just need to hide a portion of the page if there is no JS, but that's not what the OP was asking. He asked specifically for a way to check for JS from PHP.
Mar 19, 2015 at 1:14 comment added m3nda Watch at @Chris Thompson.
Mar 19, 2015 at 1:07 comment added m3nda This doesn't tell you about the script, just warns the user. This is also a good way to autocheck for javascript. Just need to refresh url to the current phpsessid/session and you'll get the confirmation about is not present. No matter if you do w or w/o the javascript, check for it is just easy.
Nov 8, 2014 at 1:12 comment added Clément Your solution is clever and efficient, but it does not validate W3C's HTML5 standards: Element style not allowed as child of element noscript in this context. (Suppressing further errors from this subtree.) You can keep this simplicity but still be valid, with <noscript> <div style="display:none"> </noscript> <span>my content</span> <noscript></div></noscript>.
Feb 29, 2012 at 17:01 history answered Andy CC BY-SA 3.0