| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 65408 | 2006-01-17 06:40:00 | Javascript Detection Issue - Website | Erayd (23) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 421812 | 2006-01-17 06:40:00 | Hi, I have an issue with javascript detection for a site I am writing. I need a way to reliably detect javascript on a user's browser, and then send the information back to the server. It's not enough just to know if the rowser supports it or not - I actually need to know whether js will run. The 'javascript/no javascript' status must then be written to a PHP session variable or MySQL database (session vars preferred). The server needs to know the js status before starting processing of the next requested page. I am currently using PHP browser sessions / cookies, and can use associated DB fields if necessary. The website is written with a PHP backend. The reason is this: I have quite a few javascript components on the site, but would like to be able to offer non-javascript versions to users who don't have js support. I would also like to disable the js components that can't be replicated in another way. I don't want to use per-page detection at the browser, because I am trying to keep the page source as clean as possible - I don't want unused junk just sitting in the code. Cheers, Bletch |
Erayd (23) | ||
| 421813 | 2006-01-17 07:05:00 | The 'javascript/no javascript' status must then be written to a PHP session variable or MySQL database (session vars preferred).Why not create a cookie with the result of the test, then both the Javascript code and PHP scripts can use the information. | maccrazy (6741) | ||
| 421814 | 2006-01-17 07:07:00 | Excellent idea. This leads to the next question...How do you use javascript to create a cookie? | Erayd (23) | ||
| 421815 | 2006-01-17 07:22:00 | Maybe this page will give you some ideas: Javascript Source (www.javascriptkit.com) | Myth (110) | ||
| 1 | |||||