当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Google Audit Question

问题描述:

The following external CSS files were

included after an external JavaScript

file in the document head. To ensure

CSS files are downloaded in parallel,

always include external CSS before

external JavaScript. 1 inline script

block was found in the head between an

external CSS file and another

resource. To allow parallel

downloading, move the inline script

before the external CSS file, or after

the next resource.

My HTML is:

<head>

<link rel="Stylesheet" href="gStyle.css" />

<script type="text/javascript" src="gMain.js"></script>

<script type="text/javascript" language="javascript">

// Your chart object(s)

var myChart;

// Function to hold all chart creation

function initCharts() {

myChart = new ganttChart("chart1");

myChart.gAddBar("Dynamic!", "22/3/2010", "3/4/2010");

myChart.gLoadData("Going to the shop*4/3/2010*19/3/2010*Watching TV*9/3/2010*23/3/2010*Watching TV*1/3/2010*23/3/2010*Watching TV*18/3/2010*28/3/2010*END INPUT*1/3/2010*9/3/2010");

myChart.gDraw();

myChart.gChangeBarColour(1, "#dd2200");

myChart.gChangeBarColour(2, "#9900ee");

myChart.gChangeBarColour(3, "#00dd00");

myChart.gChangeBarColour(4, "#ffbb00");

myChart.gChangeBarColour(5, "#00aa99");

}

</script>

</head>

<body onload="initCharts()">

<div id="chart1" class="gContainer">

</div>

<div id="db"></div>

</body>

Is it getting confused between the body inline script?

网友答案:

Inspect the page elements. Probably your Chrome extensions are dynamically adding scripts to the page in HEAD.

网友答案:

I think that when javascript is downloaded the browser must wait to get it all and then run it - this stops it going to the next line directly and getting it. I guess styles all get downloaded and then computed down to inheritance position and importance etc...so they can download in parallel.

This kind of thing is hard to regulate in a CMS with components that load their own style and js.

网友答案:

For me, Google Analytics library inserted scripts before the rest of mine.

分享给朋友:
您可能感兴趣的文章:
随机阅读: