且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我们可以知道用户是否有js?

更新时间:2023-12-03 16:44:16

要测试javascript是否已被设置,请尝试使用以下链接:

starters:

http://www.google.com/search?q = test%... ript%20enabled


根据经验,总是在服务器端验证表单数据(php)。

在客户端验证是只有当你给用户一个快速的

错误信息告诉他们输入不完整或不正确时才有用。

这只是为了让他们不要必须等待往返于服务器的

才能发现他们忘记了一个字段。

11月30日下午6:27,Ken1 < ken ... @ gmail.comwrote:
To test if javascript is enbabled, try some of these links for
starters:

http://www.google.com/search?q=test%...ript%20enabled

As a rule of thumb, always validate form data on the server side (php).
Validating at the client is only helpful if you give the user a quick
error message telling them their input is not complete or incorrect.
It''s just to so that they don''t have to wait for the round trip from
the server to find out they forgot a field.
On Nov 30, 6:27 pm, "Ken1" <ken...@gmail.comwrote:

有没有办法知道用户是否有javascript?另外,在js和php中验证所有输入是否是一个好主意?或者这会减慢这个网站的价值吗?
Is there a way to know if the user has javascript on? Also, is it a
good idea to validate all input in js and php or will this slow down
the website?




Ken1写道:

Ken1 wrote:

有没有办法要知道用户是否有javascript?
Is there a way to know if the user has javascript on?



< form ...>

....

< noscript>

< input type =" hidden"名称= QUOT; NoScript的&QUOT; value =" true">

< / noscript>

....

< / form>

<form ...>
....
<noscript>
<input type="hidden" name="NoScript" value="true">
</noscript>
....
</form>


另外,在js和php中验证所有输入是否是个好主意或者这会慢下来

网站?
Also, is it a
good idea to validate all input in js and php or will this slow down
the website?



拥有它是一个非常好的主意。相信它是非常糟糕的主意。 :-)

It is a very good idea to have it. It is very bad idea to trust it. :-)


VK在11/30/2006 11:26 PM说:以下内容:
VK said the following on 11/30/2006 11:26 PM:

Ken1写道:
Ken1 wrote:

>有没有办法知道用户是否有javascript?
>Is there a way to know if the user has javascript on?



< form ...>

...

< noscript>

< input type =" hidden"名称= QUOT; NoScript的&QUOT; value =" true">

< / noscript>

...

< / form>


<form ...>
...
<noscript>
<input type="hidden" name="NoScript" value="true">
</noscript>
...
</form>



只要你不介意无效的HTML及其带来的后果

吧。
>
-

兰迪

机会有利于预备心灵

comp.lang.javascript常见问题 - http://jibbering.com/faq

Javascript***实践 - http://www.JavascriptToolbox.com/bestpractices/

As long as you don''t mind invalid HTML and the consequences that come
from it.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/