Reputation: 753
Before Entering my site, I have a flash intro that is played, and now, I want to know how I can make it so that if the intro page has already been seen, that it does not show it next time, until the cookie expires or is deleted.
Upvotes: 0
Views: 3988
Reputation: 4431
you can use javascript to read and write cookies by using javascript code and make your logic in javascript function i.e.
function GetSetCookie() {
var version = getCookie("version");
if (version != null && version != "") {
if (version == 'full') {
version = 'text';
}
else {
version = 'full';
}
}
else {
version = 'full';
}
setCookie("version", version, 365);
window.top.location.reload();
}
function setCookie(c_name, value, exdays) {
var exdate = new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
document.cookie = c_name + "=" + c_value + "; path=/";
}
function getCookie(c_name) {
var i, x, y, ARRcookies = document.cookie.split(";");
for (i = 0; i < ARRcookies.length; i++) {
x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
x = x.replace(/^\s+|\s+$/g, "");
if (x == c_name) {
return unescape(y);
}
}
}
By using these function you can read and write cookies and mke you login according to this and use
location.top.href = "http://www.xyz.com/";
for redirecting a page URL.....
Upvotes: 2
Reputation: 9423
You could use the Local Shared Object functionality of Flash player to read user preferences. Store a Boolean value and check for it every time the movie is initiated. For more on LSO or (Flash Cookies)
http://en.wikipedia.org/wiki/Local_Shared_Object
It's supported all the way through flash player 6 and AS2/3
Upvotes: 1
Reputation: 631
Then you must set the cookie on the client side after or during the intro, via Javascript for example, and then look for that cookie whenever a request is received by the server. If it exists, alter your response in a way that does not include the intro or at least stops it from playing.
Upvotes: 0