<!--
/*************************************************************
* This script is developed by Arturs Sosins aka ar2rsawseen, http://webcodingeasy.com
* Fee free to distribute and modify code, but keep reference to its creator
*
* This class can be used to manipulate SharedObjects (aka Flash cookies)
* using swf file provided in package with different domain and namespace sstings.
* This class can set values from javascript, get saved values from
* SharedObjects (preserving data types) and delete SharedObjects.
*
* For more information, examples and online documentation visit:
* http://webcodingeasy.com/JS-classes/Manage-SharedObjects-using-Javascript
**************************************************************/
-->
<html>
<head>
</head>
<body>
<p><input type='button' value='Set' onclick='try_set();'/></p>
<p><input type='button' value='Get' onclick='try_get();'/></p>
<p><input type='button' value='All' onclick='try_all();'/></p>
<script type="text/javascript" src="./fcookie.packed.js" ></script>
<script type="text/javascript">
var fc = new fcookie({onload: function(){alert("loaded");}});
//setter test
function try_set()
{
fc.set("string", "somestring");
fc.set("number", 11);
fc.set("bool", true);
fc.set("object", {"something": "nothing"});
var obj = {"uno" : "one", "duo" : 2};
//setting whole object
fc.set(obj);
}
function try_get()
{
//getter test
var get = fc.get("string");
alert(typeof(get) + " " + get);
var get = fc.get("number");
alert(typeof(get) + " " + get);
var get = fc.get("bool");
alert(typeof(get) + " " + get);
var get = fc.get("object");
alert(typeof(get) + " " + get["something"]);
}
function try_all()
{
//get all
var all = fc.get_all();
for(var i in all)
{
alert(typeof(all[i]) + " " + i + " " + all[i]);
}
}
</script>
</body>
</html> |