Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: RE: FLASH: Inserting cookies and all that jazz.
From: Paul Franks
Date: Fri, 4 Aug 2000 08:42:34 +0100

Ruben,

1) Depends on the server. I know it's very easy with ASP, and I believe it
is also easy with CF and PHP. Otherwise you'll have to set them using
JavaScript.
2) No. Some older browsers don't accept cookies, although these probably
won't see the Flash content either, and some people just turn them off.
3) Need to know the server, for some but here is a JavaScript one. There are
loads out there.


<html>
<head>
<title>
Simple Cookie Counter
</title>
<script language="JavaScript">
<!-- Hide this script from old browsers --
/*
This script came from the 24 hour JavaScripts Site
located at http://www.javascripts.com. It is brought to
you by Eric Jarvies, Lewis Sellers, Giuseppe Lombardo,
Kurt Anderson, and David Medinets.
*/
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;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
// This cookie is history
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var expDays = 30;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function amt(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','1')
return 1
}
else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
}
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
// -- End Hiding Here -->
</script>
</head>
<body bgcolor="#FFFFFF">
<script language="JavaScript">
<!-- Hide this script from old browsers --
/*
This script came from the 24 hour JavaScripts Site
located at http://www.javascripts.com. It is brought to
you by Eric Jarvies, Lewis Sellers, Giuseppe Lombardo,
Kurt Anderson, and David Medinets.
*/
document.write("You've been here <b>" + amt() + "</b> times.")
// -- End Hiding Here -->
</script>
</body>
</html>

hth

Paul

-----Original Message-----
From: owneratchinwag [dot] com [owneratchinwag [dot] com]On">mailto:owneratchinwag [dot] com]On Behalf Of Ruben
McDavid
Sent: 04 August 2000 07:24
To: flasheratchinwag [dot] com
Subject: FLASH: Inserting cookies and all that jazz.


I have a project to track Flash buttons that are sending the user to Flash
movies or to HTML pages in an intranet site. I started looking at the main
Flash sites and there are few comments about tracking with cookies. So, my
questions:
1. What is the best way to set up the cookies?
2. Does it work with all browsers?
3. Can I see an example to understand the process?
Thanks,
Ruben


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Full flasher archive now available online at:
http://www.chinwag.com/flasher/archive.shtml
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


Replies
  FLASH: Inserting cookies and all that ja, Ruben McDavid

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]