简体   繁体   English

消除渲染阻止JavaScript

[英]Eliminate render blocking javascript

I want to improve the performance of a web page on mobile devices by eliminating render blocking javascript from above the fold content as advised by google page speed insights. 我想通过消除折叠内容上方的渲染阻止javascript来改善移动设备上网页的性能,这是Google页面速​​度洞察所建议的。 All the javascript files the page uses are for a text box towards the top of the page where users select ingredients : 该页面使用的所有javascript文件都位于页面顶部的文本框中,用户可以在其中选择成分:

jquery-1.8.2.js, textext.js, home.js jquery-1.8.2.js,textext.js,home.js

I tried moving all these files to the end of the html, but it caused the textbox to break. 我尝试将所有这些文件移动到html的末尾,但是这导致文本框损坏。 I also tried using the async attribute for the scripts but this had the same effect. 我也尝试对脚本使用async属性,但这具有相同的效果。 Is there any way I can fix this problem? 有什么办法可以解决这个问题? The page is here . 页面在这里

A possible direction can be finding the specific blocking functions (for example, alert ). 可能的方向是找到特定的阻止功能(例如alert )。 Then overriding those with non-blocking ones, by implementing them before the current code is executed. 然后,通过在执行当前代码之前实现它们,以非阻塞性代码覆盖它们。

For example, you can implement alert as a modal, allowing the rendering to continue fluently. 例如,您可以将alert实施为模式,从而使渲染流畅地进行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 消除渲染阻止JavaScript和CSS - Eliminate render-blocking JavaScript and CSS 如何消除渲染阻塞JavaScript - How to eliminate render-blocking JavaScript 消除渲染阻止javascript - 谷歌开发者建议摘要 - Eliminate render-blocking javascript - google developers suggestions summary 如何消除手机的“渲染阻止JavaScript”错误 - How to eliminate 'Render-blocking JavaScript' error for mobile 消除渲染阻止的JavaScript和CSS-需要建议 - Eliminate render-blocking JavaScript and CSS - advice needed 使用PageSpeed消除jQuery的渲染阻止JavaScript - Using PageSpeed to eliminate render-blocking JavaScript for jQuery Bootstrap,消除渲染阻塞资源 - Bootstrap, Eliminate render-blocking resources 消除渲染阻塞资源 Wordpress - Eliminate render-blocking resources Wordpress “尽管所有JS都位于页面的底部,但是在首映内容中消除了渲染阻止JavaScript” - “Eliminate render-blocking JavaScript in above-the-fold content” even though all JS is at the bottom of the page? 在不影响响应性和性能的情况下,消除即时内容解决方案中阻止渲染的JavaScript和CSS - Eliminate render-blocking JavaScript and CSS in above-the-fold content solution without affecting responsiveness and performance
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM