我最近在 HTML 和 Javascript + jQuery 中构建的项目有一个小问题。我想防止页面缓存,因为我需要以一定的时间间隔刷新页面的某些区域。
如果我重新加载页面,那么我们可以将“no-cache”META 标记设置为标题。但是我不会重新加载页面,尽管 jQuery 使用 AJAX 调用 XML 文件,但这些 javascript 文件正在被缓存,并且会发生内存开销。因此,我的 FireFox 崩溃并且内存使用量增加到 2 GB。
任何人都可以建议我一些富有成果的东西,以便我可以解决内存开销问题并在浏览器上顺利运行我的应用程序。
function refresh() {
$('#table_info').remove();
$('#table').hide();
if (refreshTimer) {
clearTimeout(refreshTimer);
refreshTimer = null ;
}
$.ajax({
document.getElementById('refresh_topology').disabled=true;
$('<div id="preload_xml"></div>').html('<img src="pic/dataload.gif" alt="loading data" /><h3>Loading Data...</h3>').prependTo($("#td_123"));
$("#topo").hide();
$('#root').remove();
show_topology();
});
}
这是代码,并且 show_topology() 被频繁调用以使每次拓扑的不同状态。