Re: How define if javascript is on with php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16/04/2010 12:54, Ashley Sheridan wrote:
On Fri, 2010-04-16 at 12:50 +0100, Paulo-WORK wrote:
Hello and thanks for any replies that this message may get.
I have a issue to solve regarding PHP.
My website relies heavlly  on jquery and does not dowgrade properly.
I use codeigniter framework as this website has a backend .
Is it possible to detect if js is on with php?
And if so can it be set into a variable?
Paulo Carvalho


Nope, Javascript is on the client side and PHP is on the server. The server has very little knowledge of the client, and what information is sent (browser type, etc) can't be relied upon because browsers are capable of lying about what they are (in order to make themselves appear as IE for example)

JQuery should allow the site to fail gracefully into a non-Javascript version, because of the way the framework is built.

If this is something that you cannot easily do, why don't you just have PHP output some sort of default message that the site does not work without Javascript and use CSS to hide the rest of the site that requires script. Then, in JQuery, it's simple to hide the message and show the site with a couple of lines of code.

However, I would recommend trying to get your site to fail gracefully if it's possible, especially if it's going to be used by the public. Many countries (including Australia, US and most of Europe) have laws regarding accessibility now, and while the number of actual legal cases is extremely minor, it's not a good thing to ignore. Not only that, but even looking at the web stats offered by the W3C it shows that about 5% have Javascript turned off. Think about the entire world population that represents and suddenly 5% isn't such a small figure after all!

Thanks,
Ash
http://www.ashleysheridan.co.uk


Thanks for your replies.
I have at this stage a redirect stating that this website requires js to work.
the website is http://paulocarvalhodesign.co.uk
I am a selfthaught wannabe developer and my goal to this private project is to create a aplication very similar to flash. This website does not refresh until you actually hit refresh button on browser.
if i remove the redirect the pages will be all over the place.
please see it for yourselfs
sorry if my sppelling is not the best.
Paulo Carvalho

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux