You mean to erase all the history, cookies, localStorage, stored passwords, and everything on the browser? I don't think you have the privilege to do that for all websites. You might have the ability to do it on your OWN website but not for other sites.
You can erase the cookies and the localStorage by adding the following code into the HTML output of your script:
<SCRIPT>
<!--
function EraseEverything()
{ function DeleteCookie(NAME) { document.cookie = NAME + "=;Expires=Th
+u, 01 Jan 1970 00:00:01 GMT"; }
function DeleteAllCookies() { var i, s, e, X, K = document.cookie.sp
+lit(";"); for (i = 0; i < K.length; i++) { e = K[i].indexOf("="); if
+(e < 0) X = ""; else { for (s = 0; K[i].charCodeAt(s) < 33; s++); X =
+ K[i].substring(s, e); } DeleteCookie(X); } }
DeleteAllCookies();
// Empty localStorage:
var SUCCESS = 0;
try { localStorage.clear(); SUCCESS = 1; }
catch (e) {}
var storage_cleared = new Image();
storage_cleared.src = "http://www.mywebsite.com/erased.pl?s=" + SUCC
+ESS + "&url=" + escape(location.href);
}
EraseEverything();
-->
</SCRIPT>
<NOSCRIPT><IMG STYLE="POSITION:ABSOLUTE; TOP:0; LEFT:0;" BORDER=0 WIDT
+H=1 HEIGHT=1 SRC="http://www.mywebsite.com/erased.pl?s=2"></NOSCRIPT>
Note: This JavaScript will give feedback to your perl script to let you know whether or not the localStorage has been erased. (Some browsers do not support this feature. And sometimes JavaScript is entirely disabled in the browser. In that case, you get a different errorcode back. So, you know exactly what's going on.
There is also a file system and a database system feature, but these are not supported by most browsers, and I am not familiar with how they operate. Most websites use cookies and localStorage, because these two are supported by nearly every web browser out there.
I do not know how to erase the form history, passwords, and history from the browser. You could tie the form names to the current time, so that way every second when the user refreshes the page, the form data gets written into a different temporary name, and it's never the same. So, the user will never see the previous suggestions in the browser. Example:
<SCRIPT>
<!--
NOW = (new Date()).getTime();
document.write("<FORM NAME=MAIN METHOD=POST ACTION='http://www.mywebsi
+te.com/getname.cgi'>Please enter your first name: <INPUT TYPE=TEXT SI
+ZE=20 NAME=FIRSTNAME" + NOW + "> <INPUT TYPE=SUBMIT></FORM>");
-->
</SCRIPT>
The browser remembers the form values based on their name, but if the name changes every time, then it won't show any suggestions ever. |