Best way to check that javascript/cookies are enabled

Mark
Mark used Ask the Experts™
on
I have a site, based on wordpress, bootstrap, and jQuery that is completely reliant on both JavaScript and cookies.

What is the best way to warn the user that the site won't work properly if it detects either are these are not functional
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2018
Distinguished Expert 2018

Commented:
A simple HTML <noscript> tag

<noscript>Your browser does not support JavaScript!</noscript>

Open in new window

MarkProgrammer

Author

Commented:
I've heard this effects SEO depending on it's position. Also, this does not solve cookies being disabled.
Most Valuable Expert 2018
Distinguished Expert 2018
Commented:
Like anything in your page, it can affect SEO if you use it wrong. Used correctly, it won't. The idea being that if you wrap a lot of your site's content in a <noscript> tag, then it probably won't be picked up, which could harm your SEO. If you're using it to tell a user that javascript is not turned on, then you'll be fine.

As for cookies, probably the easiest way is to actually use Javascript:

var cookiesEnables = navigator.cookieEnabled; // returns trur or false

Open in new window


Obviously this won't work if Javascript is turned off, but then neither will your site, so it's not a problem.
MarkProgrammer

Author

Commented:
Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial