Javascript 向登录表单的URL添加随机数的目的是什么?

Javascript 向登录表单的URL添加随机数的目的是什么?,javascript,web,Javascript,Web,向服务器处理程序发送登录表单post时,发送math.random nocache参数的具体目的是什么 var email = encodeURI(document.getElementById('emailLogin').value); var psw = encodeURI(document.getElementById('pswLogin').value); // Set te random number to add to URL request nocache = Math.rando

向服务器处理程序发送登录表单post时,发送math.random nocache参数的具体目的是什么

var email = encodeURI(document.getElementById('emailLogin').value); var psw = encodeURI(document.getElementById('pswLogin').value); // Set te random number to add to URL request nocache = Math.random(); // Pass the login variables like URL variable http.open('get', 'login.php?email='+email+'&psw='+psw+'&nocache = '+nocache); var email=encodeURI(document.getElementById('emailLogin').value); var psw=encodeURI(document.getElementById('pswLogin').value); //设置要添加到URL请求的te随机数 nocache=Math.random(); //传递登录变量,如URL变量 http.open('get','login.php?email='+email+'&psw='+psw+'&nocache='+nocache);
添加到请求中的随机数是为了强制浏览器加载以下页面结果,而不是潜在地显示可能已被先前请求缓存的页面结果


这似乎是一个非常不安全的验证器,除非http.open()发生在HTTPS(SSL/TLS)连接上

为了确保每次登录尝试的服务器响应都是新的,并且不会像任何其他缓存的ResourceBrowser那样处理,更具体地说,chrome可以使用非常激进的缓存方案,其中请求不会发送到服务器,而是访问本地旧副本,尽管如此,这似乎是非常错误的,您永远不应该通过未加密的url传输凭据,任何监视该线路的人都可以获取凭据…登录应该是一个POST请求,而不是缓存。