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

x
  • 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?

Thanks!
0
spike3382
Asked:
spike3382
  • 2
1 Solution
 
Adam314Commented:
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.
0
 
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!
0
 
Adam314Commented:
glad it'll work.  thanks for the grade  :)
0

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