Home » Php » javascript – Testing session.cookie_httponly .htaccess

javascript – Testing session.cookie_httponly .htaccess

Posted by: admin February 25, 2020 Leave a comment

Questions:

I have been trying to confirm which browsers will accept session.cookie_httponly but for my test each browser I am using fails. Which more than likely indicates my test is not correct. What I am wanting to do is test whether or not JavaScript has access to the session cookie (cookies in general). To do this I have first set the following inside my .htaccess

php_value session.cookie_httponly 1

I then open my browser and attempt the following in JavaScript:

document.cookie = 'test';
alert(document.cookie);

If I do not receive a blank alert or an error to console I would consider that a failed test. How do I need to be setting this up in .htaccess and how should I be testing for effectiveness?

How to&Answers: