This PHP class verifies the presence of JavaScript in a browser.
The first method involves using a form that allows JavaScript to submit it before the page has loaded. Following this, the PHP code can detect if POST-data exists, which would indicate that JavaScript is enabled for the user.
The second method is slightly different in that it requires the user to have both JavaScript enabled and to allow the site to set cookies. However, this approach has a drawback in that the user must manually reload the page for PHP to detect the cookie's presence.
To utilize this PHP class, you would use the checkJsByForm() function for the first method, and checkJsByCookies() for the second. Following either of these functions, it is necessary to call the isJsActivated() function to confirm if JavaScript is enabled or not. This function returns true if JavaScript is enabled, and false if it is not.
Overall, this PHP class is an excellent tool for developers looking to confirm if users have JavaScript enabled in their browsers. The two different methods available allow for flexibility in implementation, making it a valuable addition to any developer's toolkit.
Version 1.0: N/A