Conditional check for Javascript?
-
Does anyone know of anyway within coding a template that I could check to see if a visitors browser has javascript enabled or not and then run a conditional statement based on this?
There are a few areas of a site I’m building (using WP as a CMS) which rely on javascript and would appear broken or incorrect with JS disabled in the browser.
I want to find a way to offer visitors without JS a couple of alternative pages that will look and work okay without JS.
So, in a nutshell, I guess I’m asking wether;
A) Is it possible to check to see if a visitors browser has JS enabled?
if so;
B) Use the outcome of the JS check to conditionally show one page or another
(i.e. if user has JS enabled get template-file-A.php else if user does not have JS get template-file-B.php)hope someone can help!
Many thanks
Stef
- The topic ‘Conditional check for Javascript?’ is closed to new replies.