网站简介

这是一个用于提高网页加载速度的工具,通过在当前网页中添加一个名为”nowprocket”的查询参数来实现。这个参数可以避免某些浏览器(如Internet Explorer和Trident)在页面加载时重复请求资源,从而加快页面加载速度。

如何使用

  1. 打开你的网页,将这段代码添加到你的HTML文件的<head>标签内。这段代码会自动检测你使用的浏览器是否为Internet Explorer或Trident内核的浏览器,并根据需要添加”nowprocket”参数。
if(navigator.userAgent.match(/MSIE|Internet Explorer/i)||navigator.userAgent.match(/Trident\/7\..*?rv:11/i)){  
var href=document.location.href;  
if(!href.match(/[?&]nowprocket/)){  
if(href.indexOf("?")==-1){  
if(href.indexOf("#")==-1){  
document.location.href=href+"?nowprocket=1"  
}else{  
document.location.href=href.replace("#","?nowprocket=1#")}}else{  
if(href.indexOf("#")==-1){  
document.location.href=href+"&nowprocket=1"  
}else{  
document.location.href=href.replace("#","&nowprocket=1#")}}  
}  
}  
  1. 保存并重新加载你的网页,现在你应该可以看到页面加载速度有所提升。