Hi Guys
I hope this is an easy one for you.
Basically I have a page on my website that creates a javascript based cookie on the users pc. The contents of the cookie when created looks as follows:
------------------------------
DS1113008PT_ToDoItem1
My%20message%20goes%20here
www.mydomain.co.uk/carsearch/usedcars/
1600
3131308160
29921915
1549220336
29915884
*
DS1113008PT_NumToDoList
1
www.mydomain.co.uk/carsearch/usedcars/
1600
3131308160
29921915
1549220336
29915884
*
-------------------
I am basically, looking to for a script which will detect this cookie on the users machine. If the cookie is detected then I would simply like my asp page to display the word "cookie found". If the cookie cannot be found on their machine then I would simply like no wording.
Easy you say? I know there are many cookie scripts out there that should allow me to do this and believe me, after 4 hours straight, I believe I have just about trawled thought them all.
The problem I'm having is this. If I the page that creates the cookie is located in a certain directory on my website and the page I use to detect the cookie is in another directory it doesn't detect it. However, when I create the cookie in the same directory as the page that detects it then it all works fine. I therefore need a detection script that will work in any directory of my website no matter what director the cookie was created in. is this possible?.
The script I am currently using to detect my cookie can be seen below.
If anyone can help then it would be fully appreciated
best regards
Rod from the UK
-------------DETECTION SCRIPT--------------
<script>
function getCookie(szName)
{
var szValue = null;
if(document.cookie) //only if exists
{
var arr = document.cookie.split((escape(szName) + '='));
if(2 <= arr.length)
{
var arr2 = arr[1].split(';');
szValue = unescape(arr2[0]);
}
}
return szValue;
}
</script>
<SCRIPT language=JavaScript>
<!--
var szName = getCookie("DS1113008PT_ToDoItem1");
if(szName && (szName.length != 0)) document.write('<div class="cook"><center>cookie found\/center><\/div>');
// -->
</SCRIPT>
--------------------------------------------------------