依赖Javascript/AJAX?
在相当多与向服务器发送请求相关的问题的答案中,我看到提倡使用 Javascript/AJAX。
我仍然是一个纯粹主义者,从某种意义上说,我首先尝试开发无需使用 Javascript/AJAX 即可完全运行的网站,并且仅添加它来装饰用户体验。
我认为很多看似毫不费力地提倡使用 Javascript/AJAX 的人也是专业人士,所以我有点好奇,作为专业人士,您对这种“纯粹”方法有何看法?已经过时了吗?您是否认为使用当今的技术/浏览器您应该能够依赖 Javascript/AJAX?我是否应该开始放松一点,对这种方法不那么严格?它可能会使某些部分的开发变得更加容易。 :)
还是取决于您的目标受众?
In quite a few answers to questions related to sending requests to servers, I see the use of Javascript/AJAX being advocated.
I'm still kind of a purist, in the sense that I try to develop sites that fully work without the use of Javascript/AJAX first and only add it to decorate the user experience.
I assume that quite a few people that seemingly effortless advocate the use of Javascript/AJAX are proffesionals too, so I'm kind of curious how, as a proffesional, you feel about this 'purist' approach? Is it passé? Do you feel with today's technologies/browsers you should just be able to depend on Javascript/AJAX? Should I start to losen up a bit and be less strict with this approach? It would probably make developing a bit more easy in some parts. :)
Or is it dependent on your target audience?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
当然这取决于你的观众。但我的观点是,在很多情况下,要求用户拥有支持 ajax 的浏览器是完全可以的。网站是软件。软件有系统要求。
It depends on your audience of course. But my opinion is that there are many cases where it's perfectly fine to require users to have a browser that supports ajax. Web sites are software. Software has system requirements.
我相信你的方法很好,你应该总是构建不需要 JS 的页面,但是你可以轻松地用 JS 增强它们,这样打开 JS 的用户就会受益。您可以通过 AJAX 加载内容 - 打开 JS 的用户会更快地获取内容,关闭 JS 的用户查看它也没有问题。
只需尝试搜索渐进增强和/或优雅降级
I believe that you approach is good, you should always build pages that work without JS, but you can easily enhance them with JS in a way that users that have JS turned on will benefit from. You could load content through AJAX - users with JS on will get it faster, and users with JS off will have no problem viewing it.
Just try searching for Progressive enhancement and/or Graceful degradation
这取决于您的目标受众,但如果它是公共网站,那么至少要添加一些
It depends on your target audience but if it's a public site then at least put in some <noscript> traps - even a full page warning - so that people with JS disabled aren't left with a screen full of UI elements that do nothing, or worse.
这取决于您的受众和网站的性质。我认为最好的方法是使网页 JS 的基本内容免费 - 导航等(这样搜索引擎机器人也能够浏览您的网站)并稍后添加所有复杂的内容 - 在使用 JS 加载页面之后。
因此,如果用户不支持 JS,他/她仍然可以在网站上移动。但如果启用了 JS,那么就可以使用所有的附加功能。
It depends on your audience and the nature of your site. I think the best way would be to make the basic stuff of the webpage JS free - navigation etc. (this way search engine bots are also able to browse through your site) and add all the complex stuff later - after the page load with JS.
So if the user doesn't support JS, he/she is still able to move around the site. But if JS is enabled, then it is possible to use all the bells and whistles.