什么是在运行时确定一个浏览器速度太慢,优雅地处理复杂的JavaScript / CSS的最佳方式? [英] What's the best way to determine at runtime if a browser is too slow to gracefully handle complex JavaScript/CSS?

查看:107
本文介绍了什么是在运行时确定一个浏览器速度太慢,优雅地处理复杂的JavaScript / CSS的最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用逐步启用/页面上禁用的JavaScript(和CSS)影响的想法酝酿 - 这取决于如何快速/慢速浏览器似乎是

I'm toying with the idea of progressively enabling/disabling JavaScript (and CSS) effects on a page - depending on how fast/slow the browser seems to be.

我特别想低功率移动设备和旧台式电脑 - 不只是IE6: - )

I'm specifically thinking about low-powered mobile devices and old desktop computers -- not just IE6 :-)

是否有正在做这样的事情的任何例子吗?

Are there any examples of this sort of thing being done?

什么是衡量这一目标的最佳途径 - 占的事情,比如在繁忙的CPU

What would be the best ways to measure this - accounting for things, like temporary slowdowns on busy CPUs?

注:


  • 我不感兴趣的浏览器/操作系统检测。

  • 在那一刻,我在带宽测量不感兴趣 - 唯一的浏览器/ CPU性能

  • 事情可能是有趣的测量:

    • 基础的JavaScript

    • DOM操作

    • DOM / CSS渲染

    BTW:为了不要混淆/刺激与行为不一致的用户 - 这将,当然需要在屏幕上的通知,允许用户加入/退出这个整体性能优化过程

    BTW: In order to not confuse/irritate users with inconsistent behavior - this would, of course, require on-screen notifications to allow users to opt in/out of this whole performance-tuning process.

    [更新:有,我错过了一个相关的问题:<一href=\"http://stackoverflow.com/questions/3276321/disable-javascript-function-based-on-users-computers-performance\">Disable JavaScript函数根据用户的计算机的性能。由于 Andrioid !]

    [Update: there's a related question that I missed: Disable JavaScript function based on user's computer's performance. Thanks Andrioid!]

    推荐答案

    的几点思考:


    • 在测试中放置一个时间限制似乎是一个显而易见的选择。

    • 保存测试结果在Cookie中也似乎是显而易见的。

    • 在测试
    • 测试不佳表现可能暂停进一步脚本

      • 和非阻塞提示UI的触发显示器(如保存密码现代web浏览器提示常见)

      • ,询问用户是否要选择加入进一步脚本的效果 - 而答案存储在cookie

      • 而用户没有回答的提示,然​​后定期重复测试和自动接受脚本提示如果连续测试完成比第一次更快。结果


      • 将定时外部资源的下载(如网页自己的CSS或JavaScript文件)

      • 和结果比较使用JavaScript基准测试结果。

      • 这可能是网站上依靠XHR效果和/或大量使用&LT负荷有用; IMG /方式&gt; 取值结果

      这篇关于什么是在运行时确定一个浏览器速度太慢,优雅地处理复杂的JavaScript / CSS的最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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