リンク: Macromedia Flash: javascript clientside cookie to skip flash intro after first viewing.
<html>
<head>
<script language=”JavaScript” type=”text/javascript”>
<!–
function getCookie(NameOfCookie)
{
if (document.cookie.length > 0)
{
begin = document.cookie.indexOf(NameOfCookie+”=”
if (begin != -1)
{
begin += NameOfCookie.length+1;
end = document.cookie.indexOf(”;”, begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end));
}
}
return null;
}
function setCookie(NameOfCookie, value, expiredays)
{
var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
document.cookie = NameOfCookie + “=” + escape(value)
+ ((expiredays == null) ? “” : “; expires=none” + ExpireDate.toGMTString());
}
//–>
</script>
</head>
<body bgcolor=”#FFFFFF”>
<script language=”JavaScript” type=”text/javascript”>
<!–
introMovie = getCookie(”intromov”);
if (introMovie!=”true”)
{
document.write(”<OBJECT classid=’clsid:D27CDB6E-AE6D-11cf-96B8-444553540000′”)
document.write(” codebase=’http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0‘”)
document.write(” WIDTH=550 HEIGHT=400>”)
document.write(” <PARAM NAME=movie VALUE=’images/intro.swf’> <PARAM NAME=quality VALUE=high> <PARAM
NAME=scale VALUE=noborder> <PARAM NAME=bgcolor VALUE=#FFFFFF> “)
document.write(” <EMBED src=’images/intro.swf’ quality=high scale=noborder bgcolor=#000000 “)
document.write(” WIDTH=400 HEIGHT=550 TYPE=’application/x-shockwave-flash’ “)
document.write(” PLUGINSPAGE=’http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash‘>”)
document.write(” </EMBED></OBJECT>”)
setCookie(’intromov’, true, 365)
}
else
{
document.write(”<OBJECT classid=’clsid:D27CDB6E-AE6D-11cf-96B8-444553540000′”)
document.write(” codebase=’http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0‘”)
document.write(” WIDTH=550 HEIGHT=400>”)
document.write(” <PARAM NAME=movie VALUE=’images/main.swf’> <PARAM NAME=quality VALUE=high> <PARAM
NAME=scale VALUE=noborder> <PARAM NAME=bgcolor VALUE=#FFFFFF> “)
document.write(” <EMBED src=’images/main.swf’ quality=high scale=noborder bgcolor=#000000 “)
document.write(” WIDTH=550 HEIGHT=400 TYPE=’application/x-shockwave-flash’ “)
document.write(” PLUGINSPAGE=’http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash‘>”)
document.write(” </EMBED></OBJECT>”)
}
//–>
</script>
</body>
</html>