Lotus Dominoアプリケーションで古いと動作するjavascriptを使用してセッションと持続的なCookieを設定していますが、Firefoxでうまく動作します。& Operaは動作しませんIE8で。 htmlを追加してIEのページをキャッシュしないようにすると、これは何の違いもありません。これはコードです:私は、これは、特定のLotus Dominoのではないと思いますIEでLotus Domino、Firefox、OperaのCookieが動作しないOK
//Persistant and session cookies for shopping cart and
//returning user identification
function makeCartID() {
var part1 = Math.floor(Math.random()*900) + 1000;
var part2 = Math.floor(Math.random()*90) + 100;
return part1.toString() + "-" + part2.toString();
}
//Math.ceil vs Math.floor, document these
function rand(number) {
return Math.ceil(Math.random()*number);
}
// Function to return the value of the cookie specified by "name".
// returns a String object containing the cookie value, or null if cookie not found
function getCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
// Persistent cookie for unique visitors and latent purchases
function setCustCookies() {
var thisCookie = getCookie("fwc_shop");
var myValue = thisCookie;
if(thisCookie == null) {
//Setup the random cookie value
// myValue = new Date();
// var randNum = rand(100);
myValue = makeCartID();
//The expiry date will be 5 years for production
//Starting with 1 day ...
var expiryDate = new Date();
// expiryDate.setDate(expiryDate.getMonth() + 1);
expiryDate.setDate(expiryDate.getDay() + 1);
setCookie("fwc_shop", myValue, expiryDate, "/");
}
// Session cookie for shopping cart, 15 minute default
var minutes = 15; //Testing, 60+ for production
var session = getCookie("fwc_cart");
var scdt = new Date();
var sdt = new Date(scdt.getMilliseconds + (minutes * 60 * 1000));
var sessionVal;
if(session==null){
sessionVal=myValue + "=" + scdt.toGMTString() + "_" + rand(100);
}else{
sessionVal=session;
}
setCookie("fwc_cart", sessionVal, sdt, "/");
}
setCustCookies();
// Function to delete a cookie. (Sets expiration date to current date/time)
function deleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = getCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
//Worth a try from within script library!!
deleteCookie("fwc_persist");
、奇妙な事は、私は、ローカルサーバー上で設定されているいくつかのクッキーを見ることができますが、私は思えないこれらのどの削除することはできませんということですFirefoxでやることができたら、これは私に最後の3日間のナッツを運転している!!
Firefoxデバッガはエラーを報告しておらず、IEもデバッグモードではありません。
更新 - その日の後、javascriptコードに問題はありませんが、fromの計算フィールドの次の式はセッションCookieを毎回設定します。ネイティブLotus Formulaの言語この場合は非常にシンプルで100%信頼性があります!
@If(@BrowserInfo("Cookies");""; @Return("Error: cookies not enabled."));
cookieName:="session";
part1 := @Text(@Round(1000 * @Random));
part2 := @Text(@Round(10000 * @Random));
cookieValue:= part1 + "-" + part2;
result:=cookieName + "="+ cookieValue + ";";
@SetHTTPHeader("Set-Cookie"; result)
PSはこれは私が同じコードはMozillaで動作する際にIEで動作しないJavaScriptで問題を見てきました初めてではない、私は考えているコードは、IE5でOKだったけど、今はもはや作品IEの後のバージョンでコードがトリガされたとき、誰でもこの観察結果を明らかにすることができますか?
9月12日 私は買い物カゴにかなりの進歩を遂げましたが、今は上記の数式が壊れていて、現在のページに応じてクッキーを設定していません。 Firefoxでも同じです& Opera。アクセサリー&ギフト商品が、同じコードは、両方のページ・タイプのために使用されているワイン&精神のカテゴリを表示しなくとき、私はクッキーを見ることができます....
javascriptで設定したクッキーに適用されたクッキー値が表示されないという問題は、特別なhttp_cookieフィールドを使用して進行状況が設定されたクッキーを表示する方法を理解するとかなり速いものでした:) – AndrewB