search
HomeWeb Front-endJS TutorialExploring the problem of unavailable javascript_javascript skills

我第一次遇到这个问题还是在DHTML盛行的时代. 我们对浏览器无所不用其极, 加上各种动画菜单、3D标签(我们现在已经学会不再使用这些了), 但总有人告诉我们javascript不可用.

谁禁用了javascript

第一个要问的问题是这些javascript不可用的环境在哪里. 下面是一些可能的答案:

安全系统比如noscript或者公司代理过滤掉了javascript;
功能手机比如旧式黑莓(我还记得将旧式黑莓换到Opera Mini以获得总算还过得去的上网体验);
在移动应用环境中, 图片和脚本有时候会被拆分处理;
在流量有限或者接入很慢的区域中;
人们因为个人原因禁用了javascript;
讨厌广告弹出等强势广告的人.
就像你所看到的那样, javascript被禁用的原因多种多样, 有被动的, 也有主动的. 所以不能说只有乱用网络的人才会遭遇这样的问题.

为什么javascript会被禁用

像上面所列举的那样, javascript被禁用的原因多种多样. 如果它是被有意禁用的, 那么我猜主要原因无非以下三点, 即安全考虑、广告疲劳以及慢速连接.

安全考虑在情理之中. 几乎每一个在客户端的攻击都是使用的javascript(大多数情形下都是利用了插件的漏洞). Java当然是当前最大的安全漏洞, 但是通过javascript同样会对存在漏洞的网站或者不经保护或者过时的浏览器以及操作系统造成安全威胁.

慢速连接是个很有意思的原因. 非常讽刺的是, 我们使用javascript是为了加速客户端体验. 最初使用js的一个例子就是在客户端对表单进行验证从而避免服务器端不必要的工作周期.

如果你现在正处于一个很差的连接中(比如一个无线连接或者很差的3G连接), 你想要使用Google Reader或者Gmail, 你只能得到一个不完整的页面, 这时候只有使用低版本的才能更好工作.

为了两方都好

基于环境以及连接给用户最好的体验是非常好的. 这也是渐进增强(progressive enhancement)所研究的问题. 这也并非是很高深的东西, 它很简单, 并且是处于完全的实用主义.

使用事件授权这样的技术是非常简单的. 你可以通过点击父元素的handlers来写你自己的HTML, 使用innerHTML或者其他一些更新更快的技术.

为什么是这样一个问题

坦白说, 我也不太清楚. 或许是因为我太过时了, 或许是因为我已经一次有一次对浏览器和网络连接失望了, 或许是因为我只想更安全一些. 我只是不明白为什么人们只想要js的解决方案呢, 而实际上, js只是用来提供一些增强功能的.

费解的应用边缘案例

人们时常怀有疑问的是"应用需要javascript". 如果我们足够坦诚, 我们就会发现, 这样的应用实际上是很少的. 如果一定要说出一些, 我只能想到的是浏览器中的photoshop或者其他的一些编辑器(比如视频、浏览器中的IDE)才需要依赖于javascript. 其他都可以通过重新加载和服务器端的一些部件解决.

让我们直面这样一个事实——在Node.js的时代, 服务器端也可以用javascript来写. Dav Glass of Yahoo两年前显示如果一个工具库编写成余环境独立的, 那么你就可以同时在客户端和服务器端复用这些工具.

"应用需要javascript"的真正原因似乎是其他原因, 而非技术上的.

"应用需要javascript"的真正原因

正如禁用javascript可以有很多原因, 应用需要javascript也有很多原因.

You only know JavaScript and think that people should upgrade their browsers. This is understandable, but this view is very narrow-minded and can easily fail.
The team you work with to build the application has no server-side skills. You want to be able to build the application at a low cost. This may work, but it may double the development time and money. Plan for such development in advance.
You want to write the application as soon as possible, and you Know that you will rewrite this application in the future. This is very common, especially if you can be successful because of it. May God bless you, and don't let people know that you will be around for a long time.
Your application will be in Run in a pure js environment. This of course means that you don’t have to complete your application without using js. A good example is Air applications. But you have to ensure that this environment will not cause problems in the future.
Your The app does require js to run. If that's the case, don't serve it to users who don't have js. Explain to people why and how (try to avoid telling people they need to enable js because they may not be able to do it and be more disappointed) ), and use js to redirect to your application.

Summary

In short, the problem of javascript dependency is not just for technical reasons. It raises questions about old technical practices and has a big impact on maintainability.

It can be said that if we can ask "why do we need js" instead of asking "why do people don't have js", the discussion on this issue will be more fruitful. If our technology can adapt well to different needs, go to There is no point in blaming people for not keeping up with the development of the Internet.

It also makes no sense to show the user that they can solve the problem by enabling or disabling widgets in the browser. When a normal user is stuck in your app, it is not a good idea to tell the user what is going on. .

Perhaps all these issues will no longer be a problem once node becomes mature and popular. I would be happy to see that.

Original link: That "javascript not available" case

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Python vs. JavaScript: A Comparative Analysis for DevelopersPython vs. JavaScript: A Comparative Analysis for DevelopersMay 09, 2025 am 12:22 AM

The main difference between Python and JavaScript is the type system and application scenarios. 1. Python uses dynamic types, suitable for scientific computing and data analysis. 2. JavaScript adopts weak types and is widely used in front-end and full-stack development. The two have their own advantages in asynchronous programming and performance optimization, and should be decided according to project requirements when choosing.

Python vs. JavaScript: Choosing the Right Tool for the JobPython vs. JavaScript: Choosing the Right Tool for the JobMay 08, 2025 am 12:10 AM

Whether to choose Python or JavaScript depends on the project type: 1) Choose Python for data science and automation tasks; 2) Choose JavaScript for front-end and full-stack development. Python is favored for its powerful library in data processing and automation, while JavaScript is indispensable for its advantages in web interaction and full-stack development.

Python and JavaScript: Understanding the Strengths of EachPython and JavaScript: Understanding the Strengths of EachMay 06, 2025 am 12:15 AM

Python and JavaScript each have their own advantages, and the choice depends on project needs and personal preferences. 1. Python is easy to learn, with concise syntax, suitable for data science and back-end development, but has a slow execution speed. 2. JavaScript is everywhere in front-end development and has strong asynchronous programming capabilities. Node.js makes it suitable for full-stack development, but the syntax may be complex and error-prone.

JavaScript's Core: Is It Built on C or C  ?JavaScript's Core: Is It Built on C or C ?May 05, 2025 am 12:07 AM

JavaScriptisnotbuiltonCorC ;it'saninterpretedlanguagethatrunsonenginesoftenwritteninC .1)JavaScriptwasdesignedasalightweight,interpretedlanguageforwebbrowsers.2)EnginesevolvedfromsimpleinterpreterstoJITcompilers,typicallyinC ,improvingperformance.

JavaScript Applications: From Front-End to Back-EndJavaScript Applications: From Front-End to Back-EndMay 04, 2025 am 12:12 AM

JavaScript can be used for front-end and back-end development. The front-end enhances the user experience through DOM operations, and the back-end handles server tasks through Node.js. 1. Front-end example: Change the content of the web page text. 2. Backend example: Create a Node.js server.

Python vs. JavaScript: Which Language Should You Learn?Python vs. JavaScript: Which Language Should You Learn?May 03, 2025 am 12:10 AM

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.

JavaScript Frameworks: Powering Modern Web DevelopmentJavaScript Frameworks: Powering Modern Web DevelopmentMay 02, 2025 am 12:04 AM

The power of the JavaScript framework lies in simplifying development, improving user experience and application performance. When choosing a framework, consider: 1. Project size and complexity, 2. Team experience, 3. Ecosystem and community support.

The Relationship Between JavaScript, C  , and BrowsersThe Relationship Between JavaScript, C , and BrowsersMay 01, 2025 am 12:06 AM

Introduction I know you may find it strange, what exactly does JavaScript, C and browser have to do? They seem to be unrelated, but in fact, they play a very important role in modern web development. Today we will discuss the close connection between these three. Through this article, you will learn how JavaScript runs in the browser, the role of C in the browser engine, and how they work together to drive rendering and interaction of web pages. We all know the relationship between JavaScript and browser. JavaScript is the core language of front-end development. It runs directly in the browser, making web pages vivid and interesting. Have you ever wondered why JavaScr

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use