[英]Telerik - placing JavaScript file includes at the bottom of the page
It is recommended that JavaScript files be included on the bottom of the page. 建议将JavaScript文件包含在页面底部 。 I'm using Telerik Rad Ajax controls that emit JavaScript includes on top of the page.
我正在使用Telerik Rad Ajax控件,该控件发出位于页面顶部的JavaScript。 Is there a way to force it to emit JavaScript includes at the bottom of the page?
有没有一种方法可以强制其发出页面底部的JavaScript包含内容?
A solution to this problem may be to use JQuery to load the script asynchronously like this: 解决此问题的方法可能是使用JQuery异步加载脚本,如下所示:
$(function () {
$.getScript("script.js", function () { // You may skip the second argument
alert("Done loading");
});
});
You may wait a while too like this: 您可能会像这样等待一段时间:
$(function () {
setTimeout(function () {
$.getScript("script.js");
}, 500);
});
If you place your RadAjaxManager as the last control in your markup, it will emit the JavaScript at the bottom of the page. 如果将RadAjaxManager放置为标记中的最后一个控件,它将在页面底部发出JavaScript。
However as far as the placement of the included references to the scriptresource.axd(s). 但是,就所包括的引用的放置而言,对scriptresource.axd的引用。 There's no setting to change that.
没有设置可以更改它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.