Google Gears / HTML5 的 JavaScript 包装器

发布于 2024-09-26 19:24:04 字数 276 浏览 8 评论 0原文

是否有任何 JavaScript 包装脚本可以使用 HTML5 JavaScript 功能(如果可用)(例如 locaStorage/Web 存储/Google Gears 和 HTML5 之间的任何共同点),如果浏览器不支持(例如 IE6 或 IE7),则回退到 Google Gears )

虽然 IE7/6 用户全部迁移到 IE8(或 Chrome、Firefox、Opera)是理想的情况,但它们在未来几年仍将存在(也许 IE6 不会像 IE7 持续那么久,但 IE7 缺乏任何真正的 JavaScript变化)。

Are there any JavaScript wrapper scripts available that can use HTML5 JavaScript features if they are available (e.g. locaStorage / Web Storage / anything in common between Google Gears and HTML5), falling back to Google Gears if the browser is not capable (e.g. IE6 or IE7)

While it would be ideal that IE7/6 users all move to IE8 (or Chrome, Firefox, Opera), they will still be around for years to come (maybe IE6 will not last as long as IE7, but IE7 lacks any real JavaScript changes).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

听闻余生 2024-10-03 19:24:04

对于功能检测,我认为这里的大多数人会推荐优秀的 Modernizr。当然,您仍然需要自己编写 Gears 部分,但这确实不是很难 - 只是在 Modernizr 报告您正在寻找的功能不可用后进行二次测试,或者使用以下命令创建您自己的测试addTest() API

您尝试使用 Gears 作为这些 HTML5 组件的后备,这听起来有点奇怪 - 据我所知,Gears 的渗透率非常低,所以它不可能真的是为那些人提供可靠的后备。尽管功能相似,但语法不同,因此您实际上需要为不太可能使用的东西编写两倍的代码。

For feature detection I think most here would recommend the excellent Modernizr. Of course you'd still have to write the Gears part yourself, but that really isn't very hard - just a secondary test after Modernizr reporting back that the features you're looking for isn't available, or creating your own test with the addTest() API.

It comes across as a little odd that you're trying to use Gears as a fallback for those HTML5 components - as far as I can tell, Gears penetration is very low, so it can't really be an reliable fallback for those. Although the functionality is similar, the syntax isn't, so you really are going to be writing twice the amount of code for something that's unlikely to be used.

彩扇题诗 2024-10-03 19:24:04

虽然我不知道这样的包装器,但可以使用旧的故障保护:

if(typeof SomeAdvancedFeature=='undefined')alert('Dude, get a real browser!');

While I don't know of such wrappers, one can use the old failsafe:

if(typeof SomeAdvancedFeature=='undefined')alert('Dude, get a real browser!');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文