• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 298
  • Last Modified:

Detect if javascript enabled in a perl script

Hi Experts,

Okay, huge newbie question here: is there a way to detect in a cgi perl script whether or not the user has javascript enabled?

  • 2
1 Solution
I don't know of a way directly, but there are a few things you could do to find out:

1) If there is a form that gets submitted, have a hidden field.  Then have a javascript function that puts something in that field.  When you process that form, if the field is blank (or default), no javascript.  If it has the updated value, then javascript is enabled.  If you put this on a login page, you know the user will get to it before any other pages.

2) Have a javascript redirect the web browser to the page with an extra parameter.  Then have your script check for that parameter.
For example, if you have page1.pl, have a javascript function redirect to page1.pl?javscript=yes.  Then check for the "javascript=yes" part.  If it's there, then javascript is enabled.
spike3382Author Commented:
Hey, number 1 is a great idea!  It's for a cart, and I know that something has to be added before the user hits the cart, and I can store it in their session variables... which if they aren't there means there's also nothing in the cart.  Perfect!

Thanks a lot!
glad it'll work.  thanks for the grade  :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now