Chrome浏览器的NOSCRIPT干预

The other week, there were a few articles that came out about Chrome’s NOSCRIPT intervention: an intervention that would disable JavaScript altogether on slow networks. Chrome intervening on behalf of the user when it feels the network is iffy isn’t exactly new. Chrome has several interventions including one that can replace images with placeholders and one that bypasses web fonts on slow connections. The NOSCRIPT intervention itself isn’t even new. From the looks of it, it’s been around since January (just disabled by default until now).

前一周,有几篇关于Chrome浏览器的NOSCRIPT干预的文章出炉了:这种干预会在慢速网络上完全禁用JavaScript。 当感觉网络不稳定时,Chrome代表用户进行干预并不是完全新的。 Chrome采取了多种干预措施,其中一种可以使用占位符替换图像,另一种可以在连接缓慢时绕过网络字体。 NOSCRIPT干预本身并不是什么新鲜事。 从外观上看,它从一月份开始就存在(直到现在默认情况下都处于禁用状态)。

But disabling JavaScript is a much more controversial move, it appears. Web fonts fallback very easily to system fonts so disabling web fonts is not a huge deal to most. JavaScript, however, isn’t always treated as progressive enhancement (as much as I feel it should be) and so when it goes missing, the consequences can be a bit more significant.

但是,看来禁用JavaScript是一个更具争议性的举措。 Web字体很容易回退到系统字体,因此禁用Web字体对大多数人来说并不是什么大问题。 但是,JavaScript并不总是被视为渐进式增强(正如我认为应该的那样多),因此当它丢失时,后果可能会更加严重。

As you would expect, then, there’s been a lot of ensuing conversation. However, all the articles I had read were speculating on what the intervention would look like, not what it does. It took a little digging through Blink issues, but I eventually figured out how to reliably fire up the NOSCRIPT preview so that I could test it out.

如您所料,随后进行了很多对话。 但是,我读过的所有文章都在猜测干预的效果,而不是效果。 它花了一些时间研究Blink问题,但最终我想出了如何可靠地启动NOSCRIPT预览版,以便对其进行测试。

它到底是做什么的? (What exactly does it do?)

When the preview is enabled, the browser will download any necessary resources to display the page except for any JavaScript. External JavaScript files will not be requested, and inline JavaScript will not be executed. (Though it does appear that if a service worker has been installed for the domain, it will still execute).

启用预览后,浏览器将下载所有必要的资源以显示该页面(JavaScript除外) 。 不会请求外部JavaScript文件,也不会执行内联JavaScript。 (尽管看起来确实已经为该域安装了Service Worker,但它仍将执行)。

The browser will do all the rest of the work necessary to display the page and present it to the user, with an information bar informing the user that the page has been modified to save data and giving them the option to view the “original”. When the click on the information bar, the original page will be downloaded and displayed—JavaScript included.

浏览器将完成显示页面并将其呈现给用户的所有其余工作,并带有一个信息栏,通知用户该页面已被修改以保存数据,并为他们提供了查看“原始”内容的选项。 单击信息栏时,将下载并显示原始页面-包括JavaScript。

When I first read about the intervention, I had thought the preview was some sort of static snapshot, but it’s fully interactive. Provided your site works without JavaScript, I can click from page to page, reading articles or shopping for the product I want to buy.

当我第一次阅读有关干预的内容时,我曾以为预览是某种静态快照,但它是完全交互式的。 如果您的网站可以在不使用JavaScript的情况下正常运行,那么我可以逐页单击,阅读文章或购买要购买的产品。

进行试驾 (Taking it for a test drive)

To test the intervention, you’ll need to toggle a few flags to make sure you can see the NOSCRIPT preview. Once it’s enabled by default on Android, which presumably will happen in Chrome 69, this won’t be necessary.

要测试干预措施,您需要切换一些标志以确保您可以看到NOSCRIPT预览。 一旦默认情况下在Android上启用了该功能(该功能可能会在Chrome 69中启用),则无需这样做。

To toggle the flags, open Chrome on your Android device and navigate to chrome://flags. #allow-previews and #enable-noscript-previews must each be enabled. #enable-optimization-hints should be disabled (we’ll come back to that later). You’ll also need to set the #force-effective-connection-type flag to ‘2G’ or slower.

要切换标志,请在您的Android设备上打开Chrome,然后导航至chrome://flags#allow-previews#enable-noscript-previews必须分别启用。 #enable-optimization-hints应该被禁用(我们稍后会再讲)。 您还需要将#force-effective-connection-type标志设置为“ 2G”或更慢。

什么时候开始? (When does it kick in?)

The intervention kicks in when two criteria are met (it’s a bit more complicated than that, but we’ll get to that in a minute):

当满足两个条件时,干预就开始了(比这要复杂一些,但我们将在一分钟内解决):

  1. The effective network connection type is 2G or slower

    有效的网络连接类型为2G或更慢
  2. The Data Saver proxy is enabled

    启用了Data Saver代理

If y

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值