JavaScript Detection

Hi Experts,

Is there a way that I can detect if a browser has JavaScript enabled, the JavaScript version (if there is such a property), and if pop-ups are enabled?

Thank you
APD TorontoSoftware DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
No, not really.  You can use AJAX to detect that it IS enabled but not that it is disabled.  Pretty much the same with popups.  You have to use AJAX in the popup to tell you that it works.  Without AJAX, the server never knows if those things are available and you can't use javascript to detect itself if it is disabled.
RobOwner (Aidellio)Commented:
The javascript version is tied with the version of the browser.  You can get this information using the get-browser function:

you can also display to the user what to do if their javascript is disabled by using the noscript tags:

To detect if JavaScript is disabled you would have to do some double handling such as having the browser use javascript to perform an AJAX call to start a session and then that page would redirect to detect if the session was created or not, indicating whether JS is enabled.
We've discussed this at length before:
My comments in that question that it is NOT possible are specific to a page and not having to refresh or redirect.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dave BaldwinFixer of ProblemsCommented:
Here is a page I use for some javascript into.  Copy the code if you want, I did.
Rainer JeschorCommented:

to detect if JavaScript is enabled/disabled there are two main techniques:
1. Use the <noscript> tag
This one should only be displayed/executed when JavaScript is disabled.

2. Set a cookie with JavaScript and create a new request to the server. Then you can check if the cookie exists/contains a value on the server side

To detect if popups are blocked you might try this JavaScript code:
if (myWindow== null || typeof(myWindow)=='undefined') { 
  alert('Popups are disabled'); 

Open in new window

Please be aware that the last time I did use this check has been a couple of years ago and I do not know how the latest browsers and add-ons react on this.

To detect the JavaScript version you can try something like this:

Ray PaseurCommented:
Here is my take on it.  Maybe this can work for you, too.  Browsers do not reveal much information to the server.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.