How can I write to a file to the client with Javascript?
Created May 7, 2012
Nitesh Naveen Basically, you cannot write to the client machine directly from the browser as that violates browser security. Such a facility would permit anyone to write a virus in Javascript that could infect your machine when you open a webpage.
You can however write to a cookie using javascript if you just want temporary storage:
<SCRIPT>
// Create a cookie with the specified name and value.
function SetCookie(sName, sValue)
{
date = new Date();
document.cookie = sName + "=" + escape(sValue) +
"; expires=" + date.toGMTString();
}
</SCRIPT>