[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 295
  • 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  :)

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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