調べてみたところ、正確な解決策を見つけることができませんでしたが、存在する場合はお詫び申し上げます。
現在、私が抱えている問題は、Internet Explorer の古いバージョン、つまり IE9 未満のユーザーに対して、セッションごとに 1 回 div を表示することです。
これが私がすぐにまとめたコードですが、機能していないようです。誰かが何が問題なのか教えてもらえますか? 私はそれをすべて間違っていますか?
<!--[if lt IE 9]>
<script>
/* Set initial cookie after entire page has loaded */
document.cookie="messageseen=true";
/***********
This cookie won't exist initially, but when the if statement below checks
for the message seen cookie, the clear message cookie will also be set,
this is so on subsequent page-loads, it won't take 5 seconds for the the
message to disappear.
***********/
if (document.cookie == "clearmessage") {
$('.ie-message').hide(); // hide message without delate
}
/***********
After 5 seconds, check for the messageseen cookie, if it exists, set the
clearmessage cookie and hide .ie-message. On all subsequent page-loads,
the message will be hidden immediately without the delay.
***********/
setTimeout(function (){
if (document.cookie == "messageseen") {
document.cookie="clearmessage=true";
$('.ie-message').hide(); // hide message if cookie is set
}
}, 5000); // delay the hiding of the message for 5 seconds
</script>
<![endif]-->