XSS攻擊與防範

function submit() { var content = document.getElementById("content").value; document.write(content); } function escape(c) { return c.replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/"/g, '&quot;'); } function submit() { var content = escape(document.getElementById("content").value); document.write(content); }

Set-Cookie: <name>=<value>[; <max-age>=][; expires=<date>][; domain=<domain>][; path=<some>][; secure][; HttpOnly]/<some>/<domain>/<date>/<max-age>/<value>/<name>