Web开发小技巧
1.让ie8以ie7的模式渲染
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
2.获取网页的当前cookie
javascript:alert(document.cookie)
注解:检测xss
">javascript:alert(document.cookie)
</sctipt>javascript:alert(document.cookie)
XSS典型的字符串
ABC<a href=javascript:alert(1)>DEF</a>
<img src=asdf onerror=alert(document.cookie)>
http://localhost/hello.aspx?name=myurl"><script>alert(123)</script>
3.防止网页后退
<body onbeforeunload="window.location.replace('')">
4.js对话框提示
Response.Write("<script>alert('修改成功!');location.href='editnews.aspx'</script>"); //同级页面
Response.Write("<script>alert('修改成功!');top.location.href='editnews.aspx'</script>"); //上级页面