English 中文(简体)
是否存在着通过服务方条件装载javascript或CSS的倒数?
原标题:Are there downsides to loading javascript or CSS via server-side conditionals?

请允许我说,我有一只小页或几页的单页或数页的文件。 我也有一个方法可以轻松地确定何时使用这些网页,例如可读的URL。 是否采用服务机方测试为联合材料提供有条件服务,以了解是否有必要使用该书? 举例来说,我可以这样做:

<?php
if($page= myFancyPage )
{
?>
    <script src="myFancyScipt.js"></script>
<?php
}
?>

我不会失去浏览器带来的益处? 我为什么不这样做,还有其他原因?

我认识到,由于一个地点条件庞大且条件越来越苛刻,因此可能得不到治疗。 但除了这一问题外,是否有理由避免这种做法?

最佳回答

这是因为这一条件属于国家扫盲委员会而不是国家扫盲委员会。

客户没有任何想法why,但是,如果收到的话,就会有线索。

问题回答

客户方面(浏览器)发生浏览器,而贵重设备将在服务器方面执行。 如果您的浏览器看到一个包含myFancygust.js的网页,那么随后对该网页的所有要求都将使用myFancy式标本.js,假定服务器的回复头人允许该页面,浏览器服从机长。

否则,你就不享受偷窃档案的好处,除非他们再需要,否则他们不会 served! 档案库只有在档案资料未经改动而且已经出现在客户手中的情况下,才能使你受益。

有选择地与您的外部档案(仅连接this页面需求的文档)联系起来是有好处的,因为你的档案将加快负荷,因为它必须把多余的j/cs捆绑起来。 ......你只能增加网页上所需要的文件。

It depends...

一般说来,建议是尽量减少外部资源申请的页数,因为外部请求/答复的间接费用往往比档案来源并入另一个文件时要多。

因此,标准业绩建议是合并联合材料档案,以创造最低下载次数。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签