0

Can an htaccess could detect a browser if it's javascript enable or disabled and write a certain condition if javascript is disbled?

Like this

if(js)

DirectoryIndex ../locnfo/jsenable.php else

DirectoryIndex ../locnfo/jsdisable.php

1
  • why you tagged this question with PHP? Commented Mar 24, 2011 at 5:42

2 Answers 2

2

This has to be done on the client side, it cannot be detected elsewhere. The best thing I would suggest is to have something like

<script type="text/javascript">
   document.write('<script type="text/javascript" src="path/to/js"></script>');
</script>

so the file is only included if Javascript is enabled.

Sign up to request clarification or add additional context in comments.

Comments

2

No, an .htaccess file cannot do such a thing : an .htaccess file configures how Apache (server) behaves -- while Javascript is something that's on the client-side (browser).

If you want to detect whether Javascript is enabled or not, you'll have to do that on the client-side.
About that, here are a couple of questions / answers that might help :

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.