当将登录表单发送到服务器处理程序时,发送 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);
最佳答案
添加到请求中的随机数是为了强制浏览器加载以下页面结果,而不是潜在地显示可能已被较早请求缓存的结果。
就其值(value)而言——这似乎是一个非常不安全的身份验证器——除非 http.open() 发生在 HTTPS (SSL/TLS) 连接上。
关于javascript - 向登录表单的 URL 添加随机数的目的是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11834075/