Ich hab jetzt einen anderen Ansatz beim Anzeigen der noch verfügbaren Zeichen gewählt (siehe Code). Selbes Ergebnis: webkitbasierende Browser verweigern das setCookie.
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title></title>
<script type="text/javascript">
function saveCookie (cTitle, cValue, cExpiration) {
var now = new Date();
var endTime = new Date(now.getTime() + cExpiration);
document.cookie = cTitle+"="+escape(cValue)+"; expires="+endTime.toGMTString()+";";
}
function readCookie (cTitle) {
var dcookie = document.cookie;
var cname = cTitle+"=";
var clen = dcookie.length;
var cbegin = 0;
while (cbegin < clen) {
var vbegin = cbegin + cname.length;
if (dcookie.substring(cbegin, vbegin) == cname) {
var vend = dcookie.indexOf(";", vbegin);
if (vend == -1) vend = clen;
return unescape(dcookie.substring(vbegin, vend));
}
cbegin = dcookie.indexOf(" ", cbegin) + 1;
if (cbegin == 0) break;
}
return null;
}
function killCookie (cTitle) {
document.cookie = cTitle+"="+"; expires=Thu, 01-Jan-70 00:00:01 GMT;";
}
function CheckLen() {
var maxlaenge = 4000;
var feldinhalt = document.memo.cValue.value;
var rest = maxlaenge -feldinhalt.length;
if(rest<=0) {
document.memo.numb.value = 0;
document.memo.cValue.value = feldinhalt.substring(0,maxlaenge);
}
document.memo.numb.value = rest;
}
</script>
</head>
<body>
<h2>Memo</h2>
<form name="memo">
<p><label for="cTitle">Title:</label><br />
<input type="text" id="cTitle" name="cTitle" size="37" value="Cookie01" /></p>
<p><label for="cValue">Content:</label><br />
<textarea id="cValue" name="cValue" cols="50" rows="10" onChange="CheckLen()" onFocus="CheckLen()" onKeyDown="CheckLen()" onKeyUp="CheckLen()">Memos will be saved in your browser as cookies - with a lifetime of 12 month!</textarea></p>
<p><input type="button" onClick="cValue.value=(readCookie(document.forms[0].elements[0].value))" value="read memo" />
<input type="button" onclick="saveCookie(document.forms[0].elements[0].value, document.forms[0].elements[1].value, 1000*60*60*24*365)" value="save memo" />
<input type="button" onClick="killCookie(document.forms[0].elements[0].value)" value="delete memo" /> Characters left: <input type="text" name="numb" size="4" maxlength="4" value="4000" readonly /></p>
</form>
</body>
</html>
Wäre echt dankbar, wenn das irgend jemand peilt!!!
Schönen Gruß
Sigi