如何普遍启用Javascript? [英] how universally enabled is Javascript?

查看:56
本文介绍了如何普遍启用Javascript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我刚刚开始在我的某些网页上添加JavaScript。然后

发生在我身上,当然不是每个人都可能在他们的

浏览器中使用JavaScript而且出于安全考虑可能会禁用JavaScript

(特别是在公司网络内的机器上)。


所以我的问题是,

1:有没有估计可用的用户百分比

可用的JavaScript,

2:投入多少精力< noscript> ......< / noscript>

替代品,

3:有人可以推荐一个指南(在线或书籍)来编写JavaScript,所以

它在没有时会优雅地降级。

非常感谢大家,


John

Hi everyone,

I''ve just started adding JavaScript to some of my web pages. It then
occurred to me that of course not everyone may have JavaScript in their
browser and more probably may have JavaScript disabled for security reasons
(particularly on machines within a company network).

So my questions are,
1: is there any estimate available of the percentage of users not having
JavaScript available to them,
2: how much effort is worth putting into <noscript>......</noscript>
alternatives,
3: could someone recommend a guide (online or book) to writing JavaScript so
it gracefully degrades when not available.

Many thanks to you all,

John

推荐答案

John Pote写道:
John Pote wrote:

大家好,


我刚刚开始在我的某些网页上添加JavaScript。

然后我发现当然没有每个人都可以在他们的浏览器中使用

JavaScript可能会因为安全原因而禁用JavaScript(特别是在公司网络中的
机器上) )。


所以我的问题是,

1:有没有可用的估计用户百分比

没有JavaScript可供他们使用,
Hi everyone,

I''ve just started adding JavaScript to some of my web pages.
It then occurred to me that of course not everyone may have
JavaScript in their browser and more probably may have
JavaScript disabled for security reasons (particularly on
machines within a company network).

So my questions are,
1: is there any estimate available of the percentage of users
not having JavaScript available to them,



有很多。有些甚至彼此相似。

There are lots. Some even resemble each other.


2:投入多少精力< noscript>
......< / noscriptalternatives,
2: how much effort is worth putting into <noscript>
......</noscriptalternatives,



无,NOSCRPT元素在处理由于禁用javascript而禁用javascript的

后果时几乎没有用处
不是脚本可能无法执行的唯一条件,并且

因此不是唯一需要设计回退的条件(和

无论套件有什么条件,脚本可用但无法做到

它想要做的事情也适用于脚本无法执行的条件

执行的任何条件。

None, NOSCRPT elements are of close to no use in dealing with the
consequences of javascript being disabled as javascript being disabled
is not the only condition in which scripts may not be able to act, and
so not the only condition for which designed fall-back is required (and
whatever suites the condition where scripting is available but cannot do
what it wants to do also suites the conditions where scripts cannot
execute at all).


3:有人可以推荐一个指南(在线或书籍)写作

JavaScript,以便在不可用时优雅地降级。
3: could someone recommend a guide (online or book) to writing
JavaScript so it gracefully degrades when not available.



可能,但不会有很多。搜索

comp.lang.javascript的档案可能会最直接地考虑这个问题。


Richard 。

Possibly, but there will not be many. Searching the archives of
comp.lang.javascript would probably turn up the most direct
consideration of the subject.

Richard.


John Poteaécrit:
John Pote a écrit :

1:有没有可用的估计用户百分比有

JavaScript可供他们使用,
1: is there any estimate available of the percentage of users not having
JavaScript available to them,



据说大约10%

It''s said about 10%


2:投入多少精力< noscript> ......< / noscript>

替代品,
2: how much effort is worth putting into <noscript>......</noscript>
alternatives,



我认为JS必须只是叠加,所以noscript没有实用性:

a" normal"页面必须在没有JS的情况下工作,这最后一个带来一些

功能不是必不可少的(装饰,帮助形式......)

I think JS would have to be only in overlay, so noscript has no utility:
a "normal" page must work without JS, this last one bringing some
features not indispensable (decoration, help in forms ...)


3:有人可能会推荐一个指南(在线或书籍)来编写JavaScript,所以

它会在不可用时优雅地降级。
3: could someone recommend a guide (online or book) to writing JavaScript so
it gracefully degrades when not available.



< a href =" page.htm"

onclick =" window.open(this.href); return false ;">页< / a>


如果JS启用了文件''page.htm''将在新窗口中打开,

如果禁用,则页面在同一窗口中打开。


另一种方式(禁止在''严格''中禁止目标)

这次你我们会得到一个新窗口(JS或不是JS):


< a href =" page.htm" target =" here"

onclick =" window.open('''',''here'',''width = 400'');"> page< / a>


-

Stephane Moriaux和他不太老的Mac已经过时了

<a href="page.htm"
onclick="window.open(this.href);return false;">page</a>

If JS enabled the file ''page.htm'' will be open in a new window,
if disabled the page is opened in same window.

An other way (not allowed in ''strict'' where target is forbidden)
This time you''ll get a new window (JS or not) :

<a href="page.htm" target="here"
onclick="window.open('''',''here'',''width=400'');">page </a>

--
Stephane Moriaux and his less old Mac already out of date


嗨John,


John Pote写道:
Hi John,

John Pote wrote:

>

3:有人会推荐编写JavaScript的指南(在线或书籍)

它在没有可用时优雅地降级。
>
3: could someone recommend a guide (online or book) to writing JavaScript so
it gracefully degrades when not available.



这个难题的一个重要部分是特征检测
http://www.jibbering.com/faq/faq_not...er_detect.html


似乎就像comp.lang.javascript上的很多人一样非常关注

优雅降级,我一直在尽我所能学习

我可以做出更明智的决定。还有很多其他的开发人员在那里没有关心。如果它适用于IE6 +,FF1.5 +,Opera8 +,

Safari2 +那么很多人都很高兴并拥有满意的客户,而且他们的世界一切都很好。我花了很多时间考虑降级和

a,而前几天发了一些关于它的文字
http://peter.michaux.ca/article/81 这不是任何

延伸的确定但可能引起思考。


最大的问题似乎是当JavaScript的一个分支开始执行时,
执行并且一旦启动就必须成功运行完成。假设

您重新排列页面的视觉外观并隐藏某些

部分。如果浏览器不让那个人再做那些隐藏的部分

重新出现,那么一切都会丢失。因此,在重新排列页面之前,您必须确保

整个过程都能正常工作。重新安排需要在

之前进行网关测试,以确保浏览器可以处理所需的一切。


以下是理查德页面上的一个示例,我发现它很有用在

了解一些问题。

http://www.litotes.demon.co.uk/js_info/pop_ups.html


彼得

A big part of the puzzle is feature detection
http://www.jibbering.com/faq/faq_not...er_detect.html

It seems like many people on comp.lang.javascript are very concerned
with graceful degredation and I have been learning as much as I can so
I can make more informed decisions. There are many other developers out
there that don''t care a bit. If it works on IE6+, FF1.5+, Opera8+,
Safari2+ then many are happy and have happy clients and all is well
with their worlds. I spent a lot of time thinking about degradation and
a while ago spewed some text about it
http://peter.michaux.ca/article/81 that is not definitive by any
stretch but may provoke thought.

The biggest problem seems to come when a branch of JavaScript starts
executing and once started must run to completion successfully. Suppose
that you rearrange the visual appearance of a page and hide certain
parts. If the browser won''t let the person then make those hidden parts
reappear all is lost. So before rearranging the page you must make sure
the whole thing will work. The rearranging needs gateway tests before
starting to ensure the browser can handle everything required.

Here is an example on Richard''s page that I found useful in
understanding some of the issues.

http://www.litotes.demon.co.uk/js_info/pop_ups.html

Peter


这篇关于如何普遍启用Javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆