homepage Welcome to WebmasterWorld Guest from 54.205.254.108
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
How do I detect Javascript from within PHP
Do different thing if Javascript enabled.
neiljones




msg:1255074
 10:00 pm on Mar 8, 2004 (gmt 0)

Is there a simple way of detecting whether javascript is enabled on a browser within PHP?

This is what I want it for.
I have to POST form data to a third party site.
After validating it I can only POST data using a form with an autosubmit in Javascript.

I can do it without javascript but this requires an extra button to be clicked. to finally send the data.

I want to do it in the best way if Javascript is enabled and only the other way if it isn't.

 

daisho




msg:1255075
 3:18 am on Mar 9, 2004 (gmt 0)

There is no way since Javascript is client side. You'd have to do something in client side javascript. Ie have javascript add a POST/GET parameter to a form when submited. If the param exists then client has JS if not then they don't.

daisho

neiljones




msg:1255076
 5:28 pm on Mar 9, 2004 (gmt 0)

My solution to the problem I have is very simple once I implemented it. I am posting the answer so that anyone else searching finds it.

This is what the program now does.

1. Fill in the visible form and validate it.
2. Redisplay the page with the invisible form and a message telling the user if they see the message they need to click a button to continue.
3. Submit the invisible form using javascript.

If 3 does not work because of Javascript not working then the user is prompted anyway so both methods are covered.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved