[FX.php List] [off] Determining if client has Javascript enabled

Joel Shapiro jsfmp at earthlink.net
Tue Sep 10 14:26:59 MDT 2013


Hi Bob

I don't believe you'll find a way to use PHP to detect disabled JavaScript, since PHP is server-side and JavaScript is client-side* -- so the PHP is complete before the page gets to the client/browser.

I think you're doing it basically right by having the default pageload be for non-JS clients, and then have JS pull in your other content.  And you might try to have jQuery *quickly* hide/remove the non-JS message, even if the actual content may take a bit longer to load.

HTH,
-Joel
*FWIW: there is now server-side JavaScript, e.g. node.js, but that's irrelevant for this discussion.


On Sep 10, 2013, at 8:12 AM, Bob Patin wrote:

> I looked all over the web for a good method for determining, using PHP, whether a client has Javascript enabled.
> 
> After trying a few and not getting a single one to work as promised, I finally just resorted to a simple method, but I'm wondering what others of you use:
> 
> When using JQuery, I always load my index page with the first contents that the user will see, whether it's a login form or perhaps some greetings text.
> 
> So since JQuery is loading this when the visitor first arrives, I simply load my content DIV (where my content swaps out in the app) with a message like
> 
> "Javascript is required for this website to function.
> Please enable Javascript and reload this page."
> 
> It works fine, since the text never gets swapped out if JQuery fails to function, but I'm wondering if any of you have a better, more elegant method; using my method, the user sees the error msg. for a moment until the JQ loads the appropriate content...
> 
> 
> Bob Patin
> Longterm Solutions LLC
> bob at longtermsolutions.com
> 615-333-6858
> http://www.longtermsolutions.com
> FileMaker 9, 10, 11& 12 Certified Developer
> Member of FileMaker Business Alliance and FileMaker TechNet
> --
> Twitter: bobpatin
> AIM: longterm1954
> iChat: bobpatin
> --
> Expert FileMaker Consulting 
> FileMaker Hosting for all versions of FileMaker
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list