OK,
I created a .htm page within a new Web solution:
--------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Menu</title>
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name=ProgId content=VisualStudio.HTML>
<meta name=Originator content="Microsoft Visual Studio .NET 7.1">
<style>
<!--
#foldheader{cursor:pointer;cursor:hand ; font-weight:bold ;
list-style-image:url(fold.gif)}
#foldinglist{list-style-image:url(list.gif)}
//-->
</style>
<script language="JavaScript1.2">
<!--
//Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/02)
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use
var head="display:''"
img1=new Image()
img1.src="fold.gif"
img2=new Image()
img2.src="open.gif"
var ns6=document.getElementById&&!document.all
var ie4=document.all&&navigator.userAgent.indexOf("Ope ra")==-1
function checkcontained(e){
var iscontained=0
cur=ns6? e.target : event.srcElement
i=0
if (cur.id=="foldheader")
iscontained=1
else
while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){
if (cur.id=="foldheader"||cur.id=="foldinglist"){
iscontained=(cur.id=="foldheader")? 1 : 0
break
}
cur=ns6? cur.parentNode : cur.parentElement
}
if (iscontained){
var foldercontent=ns6? cur.nextSibling.nextSibling : cur.all.tags("UL")[0]
if (foldercontent.style.display=="none"){
foldercontent.style.display=""
cur.style.listStyleImage="url(open.gif)"
}
else{
foldercontent.style.display="none"
cur.style.listStyleImage="url(fold.gif)"
}
}
}
if (ie4||ns6)
document.onclick=checkcontained
//-->
</script>
</head>
<body MS_POSITIONING="GridLayout">
<font face="Verdana">
<ul>
<li id="foldheader">News</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="http://www.cnn.com">CNN</a></li>
<li><a href="http://www.abcnews.com">ABC News</a></li>
<li><a href="http://www.news.bbc.co.uk">BBC News</a></li>
</ul>
<li id="foldheader">Webmaster</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="http://www.dynamicdrive.com">Dynamic Drive</a></li>
<li><a href="http://www.javascriptkit.com">JavaScript Kit</a></li>
<li><a href="http://www.freewarejava.com">Freewarejava.com</a></li>
</ul>
<li id="foldheader">Nested Example</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="http://www.dynamicdrive.com">outer 1</a></li>
<li><a href="http://www.dynamicdrive.com">outer 2</a></li>
<li id="foldheader">Nested</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="http://www.dynamicdrive.com">nested 1</a></li>
<li><a href="http://www.dynamicdrive.com">nested 2</a></li>
</ul>
<li><a href="http://www.dynamicdrive.com">outer 3</a></li>
<li><a href="http://www.dynamicdrive.com">outer 4</a></li>
</ul>
</ul>
</font>
<p align="center"><font face="Arial" size="-2">Free DHTML scripts provided
by<br>
<a href="http://www.dynamicdrive.com">Dynamic Drive</a></font></p>
<script language="JavaScript1.2">
<!--
function get_cookie(Name) {
//Get cookie routine by Shelley Powers
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
// if cookie exists
if (offset != -1) {
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(off set, end))
}
}
return returnvalue;
}
var foldercontentarray=new Array()
var c=0
if (ns6){
for (i=0;i<document.getElementsByTagName("UL").length; i++){
if (document.getElementsByTagName("UL")[i].id=="foldinglist"){
foldercontentarray[c]=document.getElementsByTagName("UL")[i]
c++
}
}
}
if (get_cookie(window.location.pathname) != ''){
var openresults=get_cookie(window.location.pathname).s plit(" ")
for (i=0 ; i < openresults.length ; i++){
if (ns6){
foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis
tStyleImage="url(open.gif)"
}
else{
foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag
e="url(open.gif)"
}
}
}
if (ns6||ie4){
var nodelength=ns6? c-1 : foldinglist.length-1
var nodes=new Array(nodelength)
var openones=''
}
function checkit(){
for (i=0 ; i <= nodelength ; i++){
if
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style.
display==''))
openones=openones + " " + i
}
document.cookie=window.location.pathname+"="+openo nes
}
if (ns6||ie4)
window.onunload=checkit
//-->
</script>
</body>
</html>
--------------------------------------------------------
When I compile it, or run it straight from IIS, it will not keep cookie
state for the menu selection (not-working).
When I open the webroot folder directly from the C drive (windows explorer)
and dclick the .htm file, it opens and it keeps cookie state on the menus
(working)
What do I have to configure in order to make this work when I run the page
from IIS??
Thanks!
-Todd 33 2405
"Todd" <ts****@smithdata.net> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl... OK,
I created a .htm page within a new Web solution:
....
Todd,
IIS has nothing to do with cookies.
The difference you may be seeing would be between requesting the page via a
http: url and requesting it via a file: URL (which I believe is what happens
when you just double click in Windows Explorer). In particular, the domain
of the cookie may not match.
There's no way I'm going to read such a large amount of code looking for
this problem. I recommend that you isolate this problem down to just the
cookie issue and see if that helps you. If not, then please post the much
smaller reproducer and I'll be glad to take a look.
Maybe someone else with more patience can see the problem right away?
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
Todd,
When I run this code on my machine I get the same result both ways "dclick"
or browse it
I can not go through the entire code but what are the bad simptoms??
"Todd" <ts****@smithdata.net> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl... OK,
I created a .htm page within a new Web solution: --------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Menu</title> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name=ProgId content=VisualStudio.HTML> <meta name=Originator content="Microsoft Visual Studio .NET 7.1">
<style> <!-- #foldheader{cursor:pointer;cursor:hand ; font-weight:bold ; list-style-image:url(fold.gif)} #foldinglist{list-style-image:url(list.gif)} //--> </style> <script language="JavaScript1.2"> <!--
//Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/02) //For full source code and more DHTML scripts, visit http://www.dynamicdrive.com //This credit MUST stay intact for use
var head="display:''" img1=new Image() img1.src="fold.gif" img2=new Image() img2.src="open.gif"
var ns6=document.getElementById&&!document.all var ie4=document.all&&navigator.userAgent.indexOf("Ope ra")==-1
function checkcontained(e){ var iscontained=0 cur=ns6? e.target : event.srcElement i=0 if (cur.id=="foldheader") iscontained=1 else while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){ if (cur.id=="foldheader"||cur.id=="foldinglist"){ iscontained=(cur.id=="foldheader")? 1 : 0 break } cur=ns6? cur.parentNode : cur.parentElement }
if (iscontained){ var foldercontent=ns6? cur.nextSibling.nextSibling : cur.all.tags("UL")[0] if (foldercontent.style.display=="none"){ foldercontent.style.display="" cur.style.listStyleImage="url(open.gif)" } else{ foldercontent.style.display="none" cur.style.listStyleImage="url(fold.gif)" } } }
if (ie4||ns6) document.onclick=checkcontained
//--> </script>
</head> <body MS_POSITIONING="GridLayout"> <font face="Verdana">
<ul> <li id="foldheader">News</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.cnn.com">CNN</a></li> <li><a href="http://www.abcnews.com">ABC News</a></li> <li><a href="http://www.news.bbc.co.uk">BBC News</a></li> </ul>
<li id="foldheader">Webmaster</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">Dynamic Drive</a></li> <li><a href="http://www.javascriptkit.com">JavaScript Kit</a></li> <li><a href="http://www.freewarejava.com">Freewarejava.com</a></li> </ul>
<li id="foldheader">Nested Example</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">outer 1</a></li> <li><a href="http://www.dynamicdrive.com">outer 2</a></li> <li id="foldheader">Nested</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">nested 1</a></li> <li><a href="http://www.dynamicdrive.com">nested 2</a></li> </ul> <li><a href="http://www.dynamicdrive.com">outer 3</a></li> <li><a href="http://www.dynamicdrive.com">outer 4</a></li> </ul> </ul>
</font>
<p align="center"><font face="Arial" size="-2">Free DHTML scripts provided by<br> <a href="http://www.dynamicdrive.com">Dynamic Drive</a></font></p>
<script language="JavaScript1.2"> <!--
function get_cookie(Name) { //Get cookie routine by Shelley Powers var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) // if cookie exists if (offset != -1) { offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(off set, end)) } } return returnvalue; }
var foldercontentarray=new Array() var c=0
if (ns6){ for (i=0;i<document.getElementsByTagName("UL").length; i++){ if (document.getElementsByTagName("UL")[i].id=="foldinglist"){ foldercontentarray[c]=document.getElementsByTagName("UL")[i] c++ } } }
if (get_cookie(window.location.pathname) != ''){ var openresults=get_cookie(window.location.pathname).s plit(" ") for (i=0 ; i < openresults.length ; i++){ if (ns6){ foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis tStyleImage="url(open.gif)" } else{ foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag e="url(open.gif)" } } }
if (ns6||ie4){ var nodelength=ns6? c-1 : foldinglist.length-1 var nodes=new Array(nodelength) var openones='' }
function checkit(){ for (i=0 ; i <= nodelength ; i++){ if
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style. display=='')) openones=openones + " " + i } document.cookie=window.location.pathname+"="+openo nes }
if (ns6||ie4) window.onunload=checkit //--> </script>
</body> </html> --------------------------------------------------------
When I compile it, or run it straight from IIS, it will not keep cookie state for the menu selection (not-working).
When I open the webroot folder directly from the C drive (windows
explorer) and dclick the .htm file, it opens and it keeps cookie state on the menus (working)
What do I have to configure in order to make this work when I run the page from IIS??
Thanks!
-Todd
Todd,
When I run this code on my machine I get the same result both ways "dclick"
or browse it
I can not go through the entire code but what are the bad simptoms??
"Todd" <ts****@smithdata.net> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl... OK,
I created a .htm page within a new Web solution: --------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Menu</title> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name=ProgId content=VisualStudio.HTML> <meta name=Originator content="Microsoft Visual Studio .NET 7.1">
<style> <!-- #foldheader{cursor:pointer;cursor:hand ; font-weight:bold ; list-style-image:url(fold.gif)} #foldinglist{list-style-image:url(list.gif)} //--> </style> <script language="JavaScript1.2"> <!--
//Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/02) //For full source code and more DHTML scripts, visit http://www.dynamicdrive.com //This credit MUST stay intact for use
var head="display:''" img1=new Image() img1.src="fold.gif" img2=new Image() img2.src="open.gif"
var ns6=document.getElementById&&!document.all var ie4=document.all&&navigator.userAgent.indexOf("Ope ra")==-1
function checkcontained(e){ var iscontained=0 cur=ns6? e.target : event.srcElement i=0 if (cur.id=="foldheader") iscontained=1 else while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){ if (cur.id=="foldheader"||cur.id=="foldinglist"){ iscontained=(cur.id=="foldheader")? 1 : 0 break } cur=ns6? cur.parentNode : cur.parentElement }
if (iscontained){ var foldercontent=ns6? cur.nextSibling.nextSibling : cur.all.tags("UL")[0] if (foldercontent.style.display=="none"){ foldercontent.style.display="" cur.style.listStyleImage="url(open.gif)" } else{ foldercontent.style.display="none" cur.style.listStyleImage="url(fold.gif)" } } }
if (ie4||ns6) document.onclick=checkcontained
//--> </script>
</head> <body MS_POSITIONING="GridLayout"> <font face="Verdana">
<ul> <li id="foldheader">News</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.cnn.com">CNN</a></li> <li><a href="http://www.abcnews.com">ABC News</a></li> <li><a href="http://www.news.bbc.co.uk">BBC News</a></li> </ul>
<li id="foldheader">Webmaster</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">Dynamic Drive</a></li> <li><a href="http://www.javascriptkit.com">JavaScript Kit</a></li> <li><a href="http://www.freewarejava.com">Freewarejava.com</a></li> </ul>
<li id="foldheader">Nested Example</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">outer 1</a></li> <li><a href="http://www.dynamicdrive.com">outer 2</a></li> <li id="foldheader">Nested</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">nested 1</a></li> <li><a href="http://www.dynamicdrive.com">nested 2</a></li> </ul> <li><a href="http://www.dynamicdrive.com">outer 3</a></li> <li><a href="http://www.dynamicdrive.com">outer 4</a></li> </ul> </ul>
</font>
<p align="center"><font face="Arial" size="-2">Free DHTML scripts provided by<br> <a href="http://www.dynamicdrive.com">Dynamic Drive</a></font></p>
<script language="JavaScript1.2"> <!--
function get_cookie(Name) { //Get cookie routine by Shelley Powers var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) // if cookie exists if (offset != -1) { offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(off set, end)) } } return returnvalue; }
var foldercontentarray=new Array() var c=0
if (ns6){ for (i=0;i<document.getElementsByTagName("UL").length; i++){ if (document.getElementsByTagName("UL")[i].id=="foldinglist"){ foldercontentarray[c]=document.getElementsByTagName("UL")[i] c++ } } }
if (get_cookie(window.location.pathname) != ''){ var openresults=get_cookie(window.location.pathname).s plit(" ") for (i=0 ; i < openresults.length ; i++){ if (ns6){ foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis tStyleImage="url(open.gif)" } else{ foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag e="url(open.gif)" } } }
if (ns6||ie4){ var nodelength=ns6? c-1 : foldinglist.length-1 var nodes=new Array(nodelength) var openones='' }
function checkit(){ for (i=0 ; i <= nodelength ; i++){ if
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style. display=='')) openones=openones + " " + i } document.cookie=window.location.pathname+"="+openo nes }
if (ns6||ie4) window.onunload=checkit //--> </script>
</body> </html> --------------------------------------------------------
When I compile it, or run it straight from IIS, it will not keep cookie state for the menu selection (not-working).
When I open the webroot folder directly from the C drive (windows
explorer) and dclick the .htm file, it opens and it keeps cookie state on the menus (working)
What do I have to configure in order to make this work when I run the page from IIS??
Thanks!
-Todd
if your machine name has an underscore in it that can also
cause problems.
Dan -----Original Message----- OK,
I created a .htm page within a new Web solution: --------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN"><html> <head> <title>Menu</title> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> <meta name="GENERATOR" content="Microsoft Visual
Studio .NET 7.1"><meta name=ProgId content=VisualStudio.HTML> <meta name=Originator content="Microsoft Visual
Studio .NET 7.1"> <style> <!-- #foldheader{cursor:pointer;cursor:hand ; font-
weight:bold ;list-style-image:url(fold.gif)} #foldinglist{list-style-image:url(list.gif)} //--> </style> <script language="JavaScript1.2"> <!--
//Smart Folding Menu tree- By Dynamic Drive (rewritten
03/03/02)//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com //This credit MUST stay intact for use
var head="display:''" img1=new Image() img1.src="fold.gif" img2=new Image() img2.src="open.gif"
var ns6=document.getElementById&&!document.all var ie4=document.all&&navigator.userAgent.indexOf("Ope ra")
==-1 function checkcontained(e){ var iscontained=0 cur=ns6? e.target : event.srcElement i=0 if (cur.id=="foldheader") iscontained=1 else while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){ if (cur.id=="foldheader"||cur.id=="foldinglist"){ iscontained=(cur.id=="foldheader")? 1 : 0 break } cur=ns6? cur.parentNode : cur.parentElement }
if (iscontained){ var foldercontent=ns6? cur.nextSibling.nextSibling :
cur.all.tags("UL")[0]if (foldercontent.style.display=="none"){ foldercontent.style.display="" cur.style.listStyleImage="url(open.gif)" } else{ foldercontent.style.display="none" cur.style.listStyleImage="url(fold.gif)" } } }
if (ie4||ns6) document.onclick=checkcontained
//--> </script>
</head> <body MS_POSITIONING="GridLayout"> <font face="Verdana">
<ul> <li id="foldheader">News</li> <ul id="foldinglist" style="display:none" style=&
{head};> <li><a href="http://www.cnn.com">CNN</a></li> <li><a href="http://www.abcnews.com">ABC
News</a></li> <li><a href="http://www.news.bbc.co.uk">BBC
News</a></li> </ul>
<li id="foldheader">Webmaster</li> <ul id="foldinglist" style="display:none" style=&
{head};> <li><a href="http://www.dynamicdrive.com">Dynamic
Drive</a></li> <li><a
href="http://www.javascriptkit.com">JavaScript Kit</a></li> <li><a
href="http://www.freewarejava.com">Freewarejava.com</a></li </ul>
<li id="foldheader">Nested Example</li> <ul id="foldinglist" style="display:none" style=&
{head};> <li><a href="http://www.dynamicdrive.com">outer
1</a></li> <li><a href="http://www.dynamicdrive.com">outer
2</a></li> <li id="foldheader">Nested</li> <ul id="foldinglist" style="display:none" style=&
{head};> <li><a href="http://www.dynamicdrive.com">nested
1</a></li> <li><a href="http://www.dynamicdrive.com">nested
2</a></li> </ul> <li><a href="http://www.dynamicdrive.com">outer
3</a></li> <li><a href="http://www.dynamicdrive.com">outer
4</a></li> </ul> </ul>
</font>
<p align="center"><font face="Arial" size="-2">Free DHTML
scripts providedby<br> <a href="http://www.dynamicdrive.com">Dynamic
Drive</a></font></p> <script language="JavaScript1.2"> <!--
function get_cookie(Name) { //Get cookie routine by Shelley Powers var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) // if cookie exists if (offset != -1) { offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring
(offset, end)) } } return returnvalue; }
var foldercontentarray=new Array() var c=0
if (ns6){ for (i=0;i<document.getElementsByTagName("UL").length; i++)
{if (document.getElementsByTagName("UL")
[i].id=="foldinglist"){foldercontentarray[c]=document.getElementsByTagName("UL")
[i]c++ } } }
if (get_cookie(window.location.pathname) != ''){ var openresults=get_cookie
(window.location.pathname).split(" ") for (i=0 ; i < openresults.length ; i++){ if (ns6){ foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults
[i]].previousSibling.previousSibling.style.listStyleImage="url(open.gif)" } else{ foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex -
1].style.listStyleImage="url(open.gif)" } } }
if (ns6||ie4){ var nodelength=ns6? c-1 : foldinglist.length-1 var nodes=new Array(nodelength) var openones='' }
function checkit(){ for (i=0 ; i <= nodelength ; i++){ if ((ns6&&foldercontentarray[i].style.display=='')||
(ie4&&foldinglist[i].style.display=='')) openones=openones + " " + i } document.cookie=window.location.pathname+"="+openo nes }
if (ns6||ie4) window.onunload=checkit //--> </script>
</body> </html> --------------------------------------------------------
When I compile it, or run it straight from IIS, it will
not keep cookiestate for the menu selection (not-working).
When I open the webroot folder directly from the C drive
(windows explorer)and dclick the .htm file, it opens and it keeps cookie
state on the menus(working)
What do I have to configure in order to make this work
when I run the pagefrom IIS??
Thanks!
-Todd
.
Guys, I don't think its problems with the source code.
When I open the page via http://localhost/Menu.htm each time I expand a menu
and refresh the page, the menus always default to all being closed - not
writing to the document.cookie (stateless)
When I open the page via C:\Inetpub\wwwroot\Menu.htm each time I expand a
menu and refresh the page, the menus keep state, code writes to the
document.cookie.
All I am trying to do is add/implement a static tree navigation menu into an
ASP.NET application I have coded - and I want to keep the navigation state
(which menus the user has expanded, etc) on the client, not the server..
It was not a problem in the asp environment, but seems to be killing me in
asp.net
hehe
I can't figure out why it will not write to the document.cookie when I call
the page via http...
"MS News (MS ILM)" <sq**********@hotmail.com> wrote in message
news:Or**************@TK2MSFTNGP12.phx.gbl... Todd,
When I run this code on my machine I get the same result both ways
"dclick" or browse it I can not go through the entire code but what are the bad simptoms??
"Todd" <ts****@smithdata.net> wrote in message news:OW**************@TK2MSFTNGP12.phx.gbl... OK,
I created a .htm page within a new Web solution: --------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Menu</title> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name=ProgId content=VisualStudio.HTML> <meta name=Originator content="Microsoft Visual Studio .NET 7.1">
<style> <!-- #foldheader{cursor:pointer;cursor:hand ; font-weight:bold ; list-style-image:url(fold.gif)} #foldinglist{list-style-image:url(list.gif)} //--> </style> <script language="JavaScript1.2"> <!--
//Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/02) //For full source code and more DHTML scripts, visit http://www.dynamicdrive.com //This credit MUST stay intact for use
var head="display:''" img1=new Image() img1.src="fold.gif" img2=new Image() img2.src="open.gif"
var ns6=document.getElementById&&!document.all var ie4=document.all&&navigator.userAgent.indexOf("Ope ra")==-1
function checkcontained(e){ var iscontained=0 cur=ns6? e.target : event.srcElement i=0 if (cur.id=="foldheader") iscontained=1 else while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){ if (cur.id=="foldheader"||cur.id=="foldinglist"){ iscontained=(cur.id=="foldheader")? 1 : 0 break } cur=ns6? cur.parentNode : cur.parentElement }
if (iscontained){ var foldercontent=ns6? cur.nextSibling.nextSibling :
cur.all.tags("UL")[0] if (foldercontent.style.display=="none"){ foldercontent.style.display="" cur.style.listStyleImage="url(open.gif)" } else{ foldercontent.style.display="none" cur.style.listStyleImage="url(fold.gif)" } } }
if (ie4||ns6) document.onclick=checkcontained
//--> </script>
</head> <body MS_POSITIONING="GridLayout"> <font face="Verdana">
<ul> <li id="foldheader">News</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.cnn.com">CNN</a></li> <li><a href="http://www.abcnews.com">ABC News</a></li> <li><a href="http://www.news.bbc.co.uk">BBC News</a></li> </ul>
<li id="foldheader">Webmaster</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">Dynamic Drive</a></li> <li><a href="http://www.javascriptkit.com">JavaScript Kit</a></li> <li><a
href="http://www.freewarejava.com">Freewarejava.com</a></li> </ul>
<li id="foldheader">Nested Example</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">outer 1</a></li> <li><a href="http://www.dynamicdrive.com">outer 2</a></li> <li id="foldheader">Nested</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">nested 1</a></li> <li><a href="http://www.dynamicdrive.com">nested 2</a></li> </ul> <li><a href="http://www.dynamicdrive.com">outer 3</a></li> <li><a href="http://www.dynamicdrive.com">outer 4</a></li> </ul> </ul>
</font>
<p align="center"><font face="Arial" size="-2">Free DHTML scripts
provided by<br> <a href="http://www.dynamicdrive.com">Dynamic Drive</a></font></p>
<script language="JavaScript1.2"> <!--
function get_cookie(Name) { //Get cookie routine by Shelley Powers var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) // if cookie exists if (offset != -1) { offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(off set, end)) } } return returnvalue; }
var foldercontentarray=new Array() var c=0
if (ns6){ for (i=0;i<document.getElementsByTagName("UL").length; i++){ if (document.getElementsByTagName("UL")[i].id=="foldinglist"){ foldercontentarray[c]=document.getElementsByTagName("UL")[i] c++ } } }
if (get_cookie(window.location.pathname) != ''){ var openresults=get_cookie(window.location.pathname).s plit(" ") for (i=0 ; i < openresults.length ; i++){ if (ns6){ foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis tStyleImage="url(open.gif)" } else{ foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag e="url(open.gif)" } } }
if (ns6||ie4){ var nodelength=ns6? c-1 : foldinglist.length-1 var nodes=new Array(nodelength) var openones='' }
function checkit(){ for (i=0 ; i <= nodelength ; i++){ if
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style. display=='')) openones=openones + " " + i } document.cookie=window.location.pathname+"="+openo nes }
if (ns6||ie4) window.onunload=checkit //--> </script>
</body> </html> --------------------------------------------------------
When I compile it, or run it straight from IIS, it will not keep cookie state for the menu selection (not-working).
When I open the webroot folder directly from the C drive (windows explorer) and dclick the .htm file, it opens and it keeps cookie state on the
menus (working)
What do I have to configure in order to make this work when I run the
page from IIS??
Thanks!
-Todd
if your machine name has an underscore in it that can also
cause problems.
Dan -----Original Message----- OK,
I created a .htm page within a new Web solution: --------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN"><html> <head> <title>Menu</title> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> <meta name="GENERATOR" content="Microsoft Visual
Studio .NET 7.1"><meta name=ProgId content=VisualStudio.HTML> <meta name=Originator content="Microsoft Visual
Studio .NET 7.1"> <style> <!-- #foldheader{cursor:pointer;cursor:hand ; font-
weight:bold ;list-style-image:url(fold.gif)} #foldinglist{list-style-image:url(list.gif)} //--> </style> <script language="JavaScript1.2"> <!--
//Smart Folding Menu tree- By Dynamic Drive (rewritten
03/03/02)//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com //This credit MUST stay intact for use
var head="display:''" img1=new Image() img1.src="fold.gif" img2=new Image() img2.src="open.gif"
var ns6=document.getElementById&&!document.all var ie4=document.all&&navigator.userAgent.indexOf("Ope ra")
==-1 function checkcontained(e){ var iscontained=0 cur=ns6? e.target : event.srcElement i=0 if (cur.id=="foldheader") iscontained=1 else while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){ if (cur.id=="foldheader"||cur.id=="foldinglist"){ iscontained=(cur.id=="foldheader")? 1 : 0 break } cur=ns6? cur.parentNode : cur.parentElement }
if (iscontained){ var foldercontent=ns6? cur.nextSibling.nextSibling :
cur.all.tags("UL")[0]if (foldercontent.style.display=="none"){ foldercontent.style.display="" cur.style.listStyleImage="url(open.gif)" } else{ foldercontent.style.display="none" cur.style.listStyleImage="url(fold.gif)" } } }
if (ie4||ns6) document.onclick=checkcontained
//--> </script>
</head> <body MS_POSITIONING="GridLayout"> <font face="Verdana">
<ul> <li id="foldheader">News</li> <ul id="foldinglist" style="display:none" style=&
{head};> <li><a href="http://www.cnn.com">CNN</a></li> <li><a href="http://www.abcnews.com">ABC
News</a></li> <li><a href="http://www.news.bbc.co.uk">BBC
News</a></li> </ul>
<li id="foldheader">Webmaster</li> <ul id="foldinglist" style="display:none" style=&
{head};> <li><a href="http://www.dynamicdrive.com">Dynamic
Drive</a></li> <li><a
href="http://www.javascriptkit.com">JavaScript Kit</a></li> <li><a
href="http://www.freewarejava.com">Freewarejava.com</a></li </ul>
<li id="foldheader">Nested Example</li> <ul id="foldinglist" style="display:none" style=&
{head};> <li><a href="http://www.dynamicdrive.com">outer
1</a></li> <li><a href="http://www.dynamicdrive.com">outer
2</a></li> <li id="foldheader">Nested</li> <ul id="foldinglist" style="display:none" style=&
{head};> <li><a href="http://www.dynamicdrive.com">nested
1</a></li> <li><a href="http://www.dynamicdrive.com">nested
2</a></li> </ul> <li><a href="http://www.dynamicdrive.com">outer
3</a></li> <li><a href="http://www.dynamicdrive.com">outer
4</a></li> </ul> </ul>
</font>
<p align="center"><font face="Arial" size="-2">Free DHTML
scripts providedby<br> <a href="http://www.dynamicdrive.com">Dynamic
Drive</a></font></p> <script language="JavaScript1.2"> <!--
function get_cookie(Name) { //Get cookie routine by Shelley Powers var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) // if cookie exists if (offset != -1) { offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring
(offset, end)) } } return returnvalue; }
var foldercontentarray=new Array() var c=0
if (ns6){ for (i=0;i<document.getElementsByTagName("UL").length; i++)
{if (document.getElementsByTagName("UL")
[i].id=="foldinglist"){foldercontentarray[c]=document.getElementsByTagName("UL")
[i]c++ } } }
if (get_cookie(window.location.pathname) != ''){ var openresults=get_cookie
(window.location.pathname).split(" ") for (i=0 ; i < openresults.length ; i++){ if (ns6){ foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults
[i]].previousSibling.previousSibling.style.listStyleImage="url(open.gif)" } else{ foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex -
1].style.listStyleImage="url(open.gif)" } } }
if (ns6||ie4){ var nodelength=ns6? c-1 : foldinglist.length-1 var nodes=new Array(nodelength) var openones='' }
function checkit(){ for (i=0 ; i <= nodelength ; i++){ if ((ns6&&foldercontentarray[i].style.display=='')||
(ie4&&foldinglist[i].style.display=='')) openones=openones + " " + i } document.cookie=window.location.pathname+"="+openo nes }
if (ns6||ie4) window.onunload=checkit //--> </script>
</body> </html> --------------------------------------------------------
When I compile it, or run it straight from IIS, it will
not keep cookiestate for the menu selection (not-working).
When I open the webroot folder directly from the C drive
(windows explorer)and dclick the .htm file, it opens and it keeps cookie
state on the menus(working)
What do I have to configure in order to make this work
when I run the pagefrom IIS??
Thanks!
-Todd
.
Guys, I don't think its problems with the source code.
When I open the page via http://localhost/Menu.htm each time I expand a menu
and refresh the page, the menus always default to all being closed - not
writing to the document.cookie (stateless)
When I open the page via C:\Inetpub\wwwroot\Menu.htm each time I expand a
menu and refresh the page, the menus keep state, code writes to the
document.cookie.
All I am trying to do is add/implement a static tree navigation menu into an
ASP.NET application I have coded - and I want to keep the navigation state
(which menus the user has expanded, etc) on the client, not the server..
It was not a problem in the asp environment, but seems to be killing me in
asp.net
hehe
I can't figure out why it will not write to the document.cookie when I call
the page via http...
"MS News (MS ILM)" <sq**********@hotmail.com> wrote in message
news:Or**************@TK2MSFTNGP12.phx.gbl... Todd,
When I run this code on my machine I get the same result both ways
"dclick" or browse it I can not go through the entire code but what are the bad simptoms??
"Todd" <ts****@smithdata.net> wrote in message news:OW**************@TK2MSFTNGP12.phx.gbl... OK,
I created a .htm page within a new Web solution: --------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Menu</title> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name=ProgId content=VisualStudio.HTML> <meta name=Originator content="Microsoft Visual Studio .NET 7.1">
<style> <!-- #foldheader{cursor:pointer;cursor:hand ; font-weight:bold ; list-style-image:url(fold.gif)} #foldinglist{list-style-image:url(list.gif)} //--> </style> <script language="JavaScript1.2"> <!--
//Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/02) //For full source code and more DHTML scripts, visit http://www.dynamicdrive.com //This credit MUST stay intact for use
var head="display:''" img1=new Image() img1.src="fold.gif" img2=new Image() img2.src="open.gif"
var ns6=document.getElementById&&!document.all var ie4=document.all&&navigator.userAgent.indexOf("Ope ra")==-1
function checkcontained(e){ var iscontained=0 cur=ns6? e.target : event.srcElement i=0 if (cur.id=="foldheader") iscontained=1 else while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){ if (cur.id=="foldheader"||cur.id=="foldinglist"){ iscontained=(cur.id=="foldheader")? 1 : 0 break } cur=ns6? cur.parentNode : cur.parentElement }
if (iscontained){ var foldercontent=ns6? cur.nextSibling.nextSibling :
cur.all.tags("UL")[0] if (foldercontent.style.display=="none"){ foldercontent.style.display="" cur.style.listStyleImage="url(open.gif)" } else{ foldercontent.style.display="none" cur.style.listStyleImage="url(fold.gif)" } } }
if (ie4||ns6) document.onclick=checkcontained
//--> </script>
</head> <body MS_POSITIONING="GridLayout"> <font face="Verdana">
<ul> <li id="foldheader">News</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.cnn.com">CNN</a></li> <li><a href="http://www.abcnews.com">ABC News</a></li> <li><a href="http://www.news.bbc.co.uk">BBC News</a></li> </ul>
<li id="foldheader">Webmaster</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">Dynamic Drive</a></li> <li><a href="http://www.javascriptkit.com">JavaScript Kit</a></li> <li><a
href="http://www.freewarejava.com">Freewarejava.com</a></li> </ul>
<li id="foldheader">Nested Example</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">outer 1</a></li> <li><a href="http://www.dynamicdrive.com">outer 2</a></li> <li id="foldheader">Nested</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">nested 1</a></li> <li><a href="http://www.dynamicdrive.com">nested 2</a></li> </ul> <li><a href="http://www.dynamicdrive.com">outer 3</a></li> <li><a href="http://www.dynamicdrive.com">outer 4</a></li> </ul> </ul>
</font>
<p align="center"><font face="Arial" size="-2">Free DHTML scripts
provided by<br> <a href="http://www.dynamicdrive.com">Dynamic Drive</a></font></p>
<script language="JavaScript1.2"> <!--
function get_cookie(Name) { //Get cookie routine by Shelley Powers var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) // if cookie exists if (offset != -1) { offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(off set, end)) } } return returnvalue; }
var foldercontentarray=new Array() var c=0
if (ns6){ for (i=0;i<document.getElementsByTagName("UL").length; i++){ if (document.getElementsByTagName("UL")[i].id=="foldinglist"){ foldercontentarray[c]=document.getElementsByTagName("UL")[i] c++ } } }
if (get_cookie(window.location.pathname) != ''){ var openresults=get_cookie(window.location.pathname).s plit(" ") for (i=0 ; i < openresults.length ; i++){ if (ns6){ foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis tStyleImage="url(open.gif)" } else{ foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag e="url(open.gif)" } } }
if (ns6||ie4){ var nodelength=ns6? c-1 : foldinglist.length-1 var nodes=new Array(nodelength) var openones='' }
function checkit(){ for (i=0 ; i <= nodelength ; i++){ if
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style. display=='')) openones=openones + " " + i } document.cookie=window.location.pathname+"="+openo nes }
if (ns6||ie4) window.onunload=checkit //--> </script>
</body> </html> --------------------------------------------------------
When I compile it, or run it straight from IIS, it will not keep cookie state for the menu selection (not-working).
When I open the webroot folder directly from the C drive (windows explorer) and dclick the .htm file, it opens and it keeps cookie state on the
menus (working)
What do I have to configure in order to make this work when I run the
page from IIS??
Thanks!
-Todd
"Todd" <ts****@smithdata.net> wrote in message
news:Oe**************@TK2MSFTNGP09.phx.gbl... Guys, I don't think its problems with the source code.
When I open the page via http://localhost/Menu.htm each time I expand a
menu and refresh the page, the menus always default to all being closed - not writing to the document.cookie (stateless)
When I open the page via C:\Inetpub\wwwroot\Menu.htm each time I expand a menu and refresh the page, the menus keep state, code writes to the document.cookie.
Todd, like I said. Remove the complications of the menu code and concentrate
on the cookie problem. You'll probably find that the problem is the domain
field of the cookie. It needs to be blank for localhost.
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message
news:Oe**************@TK2MSFTNGP09.phx.gbl... Guys, I don't think its problems with the source code.
When I open the page via http://localhost/Menu.htm each time I expand a
menu and refresh the page, the menus always default to all being closed - not writing to the document.cookie (stateless)
When I open the page via C:\Inetpub\wwwroot\Menu.htm each time I expand a menu and refresh the page, the menus keep state, code writes to the document.cookie.
Todd, like I said. Remove the complications of the menu code and concentrate
on the cookie problem. You'll probably find that the problem is the domain
field of the cookie. It needs to be blank for localhost.
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
Yeah, I will try to hardcode the domain field path for the cookie and see if
that works. If not I will just scratch everything and keep client state on
an parent IFrame or something..at least I know that works.
hehe
Thanks John
-Todd
"John Saunders" <jo***********@surfcontrol.com> wrote in message
news:eU**************@TK2MSFTNGP12.phx.gbl... "Todd" <ts****@smithdata.net> wrote in message news:Oe**************@TK2MSFTNGP09.phx.gbl... Guys, I don't think its problems with the source code.
When I open the page via http://localhost/Menu.htm each time I expand a menu and refresh the page, the menus always default to all being closed - not writing to the document.cookie (stateless)
When I open the page via C:\Inetpub\wwwroot\Menu.htm each time I expand
a menu and refresh the page, the menus keep state, code writes to the document.cookie.
Todd, like I said. Remove the complications of the menu code and
concentrate on the cookie problem. You'll probably find that the problem is the domain field of the cookie. It needs to be blank for localhost. -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message
news:OQ**************@TK2MSFTNGP10.phx.gbl... Yeah, I will try to hardcode the domain field path for the cookie and see
if that works. If not I will just scratch everything and keep client state on an parent IFrame or something..at least I know that works. hehe
Todd, that's not what I said.
I said, try to find out what the domain is set to, then learn to set it the
right way.
How are you setting it now?
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
Yeah, I will try to hardcode the domain field path for the cookie and see if
that works. If not I will just scratch everything and keep client state on
an parent IFrame or something..at least I know that works.
hehe
Thanks John
-Todd
"John Saunders" <jo***********@surfcontrol.com> wrote in message
news:eU**************@TK2MSFTNGP12.phx.gbl... "Todd" <ts****@smithdata.net> wrote in message news:Oe**************@TK2MSFTNGP09.phx.gbl... Guys, I don't think its problems with the source code.
When I open the page via http://localhost/Menu.htm each time I expand a menu and refresh the page, the menus always default to all being closed - not writing to the document.cookie (stateless)
When I open the page via C:\Inetpub\wwwroot\Menu.htm each time I expand
a menu and refresh the page, the menus keep state, code writes to the document.cookie.
Todd, like I said. Remove the complications of the menu code and
concentrate on the cookie problem. You'll probably find that the problem is the domain field of the cookie. It needs to be blank for localhost. -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message
news:OQ**************@TK2MSFTNGP10.phx.gbl... Yeah, I will try to hardcode the domain field path for the cookie and see
if that works. If not I will just scratch everything and keep client state on an parent IFrame or something..at least I know that works. hehe
Todd, that's not what I said.
I said, try to find out what the domain is set to, then learn to set it the
right way.
How are you setting it now?
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
The domain is set to my machine name (todd_sloan).
How do I change it?
"John Saunders" <jo***********@surfcontrol.com> wrote in message
news:uO**************@TK2MSFTNGP12.phx.gbl... "Todd" <ts****@smithdata.net> wrote in message news:OQ**************@TK2MSFTNGP10.phx.gbl... Yeah, I will try to hardcode the domain field path for the cookie and
see if that works. If not I will just scratch everything and keep client state
on an parent IFrame or something..at least I know that works. hehe
Todd, that's not what I said.
I said, try to find out what the domain is set to, then learn to set it
the right way.
How are you setting it now? -- John Saunders Internet Engineer jo***********@surfcontrol.com
The domain is set to my machine name (todd_sloan).
How do I change it?
"John Saunders" <jo***********@surfcontrol.com> wrote in message
news:uO**************@TK2MSFTNGP12.phx.gbl... "Todd" <ts****@smithdata.net> wrote in message news:OQ**************@TK2MSFTNGP10.phx.gbl... Yeah, I will try to hardcode the domain field path for the cookie and
see if that works. If not I will just scratch everything and keep client state
on an parent IFrame or something..at least I know that works. hehe
Todd, that's not what I said.
I said, try to find out what the domain is set to, then learn to set it
the right way.
How are you setting it now? -- John Saunders Internet Engineer jo***********@surfcontrol.com
Todd,
Still works in here
"Todd" <ts****@smithdata.net> wrote in message
news:Oe**************@TK2MSFTNGP09.phx.gbl... Guys, I don't think its problems with the source code.
When I open the page via http://localhost/Menu.htm each time I expand a
menu and refresh the page, the menus always default to all being closed - not writing to the document.cookie (stateless)
When I open the page via C:\Inetpub\wwwroot\Menu.htm each time I expand a menu and refresh the page, the menus keep state, code writes to the document.cookie.
All I am trying to do is add/implement a static tree navigation menu into
an ASP.NET application I have coded - and I want to keep the navigation state (which menus the user has expanded, etc) on the client, not the server..
It was not a problem in the asp environment, but seems to be killing me in asp.net hehe
I can't figure out why it will not write to the document.cookie when I
call the page via http...
"MS News (MS ILM)" <sq**********@hotmail.com> wrote in message news:Or**************@TK2MSFTNGP12.phx.gbl... Todd,
When I run this code on my machine I get the same result both ways "dclick" or browse it I can not go through the entire code but what are the bad simptoms??
"Todd" <ts****@smithdata.net> wrote in message news:OW**************@TK2MSFTNGP12.phx.gbl... OK,
I created a .htm page within a new Web solution: --------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Menu</title> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name=ProgId content=VisualStudio.HTML> <meta name=Originator content="Microsoft Visual Studio .NET 7.1">
<style> <!-- #foldheader{cursor:pointer;cursor:hand ; font-weight:bold ; list-style-image:url(fold.gif)} #foldinglist{list-style-image:url(list.gif)} //--> </style> <script language="JavaScript1.2"> <!--
//Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/02) //For full source code and more DHTML scripts, visit http://www.dynamicdrive.com //This credit MUST stay intact for use
var head="display:''" img1=new Image() img1.src="fold.gif" img2=new Image() img2.src="open.gif"
var ns6=document.getElementById&&!document.all var ie4=document.all&&navigator.userAgent.indexOf("Ope ra")==-1
function checkcontained(e){ var iscontained=0 cur=ns6? e.target : event.srcElement i=0 if (cur.id=="foldheader") iscontained=1 else while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){ if (cur.id=="foldheader"||cur.id=="foldinglist"){ iscontained=(cur.id=="foldheader")? 1 : 0 break } cur=ns6? cur.parentNode : cur.parentElement }
if (iscontained){ var foldercontent=ns6? cur.nextSibling.nextSibling : cur.all.tags("UL")[0] if (foldercontent.style.display=="none"){ foldercontent.style.display="" cur.style.listStyleImage="url(open.gif)" } else{ foldercontent.style.display="none" cur.style.listStyleImage="url(fold.gif)" } } }
if (ie4||ns6) document.onclick=checkcontained
//--> </script>
</head> <body MS_POSITIONING="GridLayout"> <font face="Verdana">
<ul> <li id="foldheader">News</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.cnn.com">CNN</a></li> <li><a href="http://www.abcnews.com">ABC News</a></li> <li><a href="http://www.news.bbc.co.uk">BBC News</a></li> </ul>
<li id="foldheader">Webmaster</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">Dynamic Drive</a></li> <li><a href="http://www.javascriptkit.com">JavaScript
Kit</a></li> <li><a href="http://www.freewarejava.com">Freewarejava.com</a></li> </ul>
<li id="foldheader">Nested Example</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">outer 1</a></li> <li><a href="http://www.dynamicdrive.com">outer 2</a></li> <li id="foldheader">Nested</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">nested 1</a></li> <li><a href="http://www.dynamicdrive.com">nested 2</a></li> </ul> <li><a href="http://www.dynamicdrive.com">outer 3</a></li> <li><a href="http://www.dynamicdrive.com">outer 4</a></li> </ul> </ul>
</font>
<p align="center"><font face="Arial" size="-2">Free DHTML scripts provided by<br> <a href="http://www.dynamicdrive.com">Dynamic Drive</a></font></p>
<script language="JavaScript1.2"> <!--
function get_cookie(Name) { //Get cookie routine by Shelley Powers var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) // if cookie exists if (offset != -1) { offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(off set, end)) } } return returnvalue; }
var foldercontentarray=new Array() var c=0
if (ns6){ for (i=0;i<document.getElementsByTagName("UL").length; i++){ if (document.getElementsByTagName("UL")[i].id=="foldinglist"){ foldercontentarray[c]=document.getElementsByTagName("UL")[i] c++ } } }
if (get_cookie(window.location.pathname) != ''){ var openresults=get_cookie(window.location.pathname).s plit(" ") for (i=0 ; i < openresults.length ; i++){ if (ns6){ foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis tStyleImage="url(open.gif)" } else{ foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag e="url(open.gif)" } } }
if (ns6||ie4){ var nodelength=ns6? c-1 : foldinglist.length-1 var nodes=new Array(nodelength) var openones='' }
function checkit(){ for (i=0 ; i <= nodelength ; i++){ if
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style. display=='')) openones=openones + " " + i } document.cookie=window.location.pathname+"="+openo nes }
if (ns6||ie4) window.onunload=checkit //--> </script>
</body> </html> --------------------------------------------------------
When I compile it, or run it straight from IIS, it will not keep
cookie state for the menu selection (not-working).
When I open the webroot folder directly from the C drive (windows explorer) and dclick the .htm file, it opens and it keeps cookie state on the menus (working)
What do I have to configure in order to make this work when I run the page from IIS??
Thanks!
-Todd
Todd,
Still works in here
"Todd" <ts****@smithdata.net> wrote in message
news:Oe**************@TK2MSFTNGP09.phx.gbl... Guys, I don't think its problems with the source code.
When I open the page via http://localhost/Menu.htm each time I expand a
menu and refresh the page, the menus always default to all being closed - not writing to the document.cookie (stateless)
When I open the page via C:\Inetpub\wwwroot\Menu.htm each time I expand a menu and refresh the page, the menus keep state, code writes to the document.cookie.
All I am trying to do is add/implement a static tree navigation menu into
an ASP.NET application I have coded - and I want to keep the navigation state (which menus the user has expanded, etc) on the client, not the server..
It was not a problem in the asp environment, but seems to be killing me in asp.net hehe
I can't figure out why it will not write to the document.cookie when I
call the page via http...
"MS News (MS ILM)" <sq**********@hotmail.com> wrote in message news:Or**************@TK2MSFTNGP12.phx.gbl... Todd,
When I run this code on my machine I get the same result both ways "dclick" or browse it I can not go through the entire code but what are the bad simptoms??
"Todd" <ts****@smithdata.net> wrote in message news:OW**************@TK2MSFTNGP12.phx.gbl... OK,
I created a .htm page within a new Web solution: --------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Menu</title> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name=ProgId content=VisualStudio.HTML> <meta name=Originator content="Microsoft Visual Studio .NET 7.1">
<style> <!-- #foldheader{cursor:pointer;cursor:hand ; font-weight:bold ; list-style-image:url(fold.gif)} #foldinglist{list-style-image:url(list.gif)} //--> </style> <script language="JavaScript1.2"> <!--
//Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/02) //For full source code and more DHTML scripts, visit http://www.dynamicdrive.com //This credit MUST stay intact for use
var head="display:''" img1=new Image() img1.src="fold.gif" img2=new Image() img2.src="open.gif"
var ns6=document.getElementById&&!document.all var ie4=document.all&&navigator.userAgent.indexOf("Ope ra")==-1
function checkcontained(e){ var iscontained=0 cur=ns6? e.target : event.srcElement i=0 if (cur.id=="foldheader") iscontained=1 else while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){ if (cur.id=="foldheader"||cur.id=="foldinglist"){ iscontained=(cur.id=="foldheader")? 1 : 0 break } cur=ns6? cur.parentNode : cur.parentElement }
if (iscontained){ var foldercontent=ns6? cur.nextSibling.nextSibling : cur.all.tags("UL")[0] if (foldercontent.style.display=="none"){ foldercontent.style.display="" cur.style.listStyleImage="url(open.gif)" } else{ foldercontent.style.display="none" cur.style.listStyleImage="url(fold.gif)" } } }
if (ie4||ns6) document.onclick=checkcontained
//--> </script>
</head> <body MS_POSITIONING="GridLayout"> <font face="Verdana">
<ul> <li id="foldheader">News</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.cnn.com">CNN</a></li> <li><a href="http://www.abcnews.com">ABC News</a></li> <li><a href="http://www.news.bbc.co.uk">BBC News</a></li> </ul>
<li id="foldheader">Webmaster</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">Dynamic Drive</a></li> <li><a href="http://www.javascriptkit.com">JavaScript
Kit</a></li> <li><a href="http://www.freewarejava.com">Freewarejava.com</a></li> </ul>
<li id="foldheader">Nested Example</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">outer 1</a></li> <li><a href="http://www.dynamicdrive.com">outer 2</a></li> <li id="foldheader">Nested</li> <ul id="foldinglist" style="display:none" style=&{head};> <li><a href="http://www.dynamicdrive.com">nested 1</a></li> <li><a href="http://www.dynamicdrive.com">nested 2</a></li> </ul> <li><a href="http://www.dynamicdrive.com">outer 3</a></li> <li><a href="http://www.dynamicdrive.com">outer 4</a></li> </ul> </ul>
</font>
<p align="center"><font face="Arial" size="-2">Free DHTML scripts provided by<br> <a href="http://www.dynamicdrive.com">Dynamic Drive</a></font></p>
<script language="JavaScript1.2"> <!--
function get_cookie(Name) { //Get cookie routine by Shelley Powers var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) // if cookie exists if (offset != -1) { offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(off set, end)) } } return returnvalue; }
var foldercontentarray=new Array() var c=0
if (ns6){ for (i=0;i<document.getElementsByTagName("UL").length; i++){ if (document.getElementsByTagName("UL")[i].id=="foldinglist"){ foldercontentarray[c]=document.getElementsByTagName("UL")[i] c++ } } }
if (get_cookie(window.location.pathname) != ''){ var openresults=get_cookie(window.location.pathname).s plit(" ") for (i=0 ; i < openresults.length ; i++){ if (ns6){ foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis tStyleImage="url(open.gif)" } else{ foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag e="url(open.gif)" } } }
if (ns6||ie4){ var nodelength=ns6? c-1 : foldinglist.length-1 var nodes=new Array(nodelength) var openones='' }
function checkit(){ for (i=0 ; i <= nodelength ; i++){ if
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style. display=='')) openones=openones + " " + i } document.cookie=window.location.pathname+"="+openo nes }
if (ns6||ie4) window.onunload=checkit //--> </script>
</body> </html> --------------------------------------------------------
When I compile it, or run it straight from IIS, it will not keep
cookie state for the menu selection (not-working).
When I open the webroot folder directly from the C drive (windows explorer) and dclick the .htm file, it opens and it keeps cookie state on the menus (working)
What do I have to configure in order to make this work when I run the page from IIS??
Thanks!
-Todd
Dan,
You totally ROCK
"Dan" <da*@nospam.com> wrote in message
news:0b****************************@phx.gbl... if your machine name has an underscore in it that can also cause problems.
Dan
-----Original Message----- OK,
I created a .htm page within a new Web solution: --------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html> <head> <title>Menu</title> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"><meta name=ProgId content=VisualStudio.HTML> <meta name=Originator content="Microsoft Visual Studio .NET 7.1"> <style> <!-- #foldheader{cursor:pointer;cursor:hand ; font-
weight:bold ;list-style-image:url(fold.gif)} #foldinglist{list-style-image:url(list.gif)} //--> </style> <script language="JavaScript1.2"> <!--
//Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/02)//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com //This credit MUST stay intact for use
var head="display:''" img1=new Image() img1.src="fold.gif" img2=new Image() img2.src="open.gif"
var ns6=document.getElementById&&!document.all var ie4=document.all&&navigator.userAgent.indexOf("Ope ra") ==-1 function checkcontained(e){ var iscontained=0 cur=ns6? e.target : event.srcElement i=0 if (cur.id=="foldheader") iscontained=1 else while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){ if (cur.id=="foldheader"||cur.id=="foldinglist"){ iscontained=(cur.id=="foldheader")? 1 : 0 break } cur=ns6? cur.parentNode : cur.parentElement }
if (iscontained){ var foldercontent=ns6? cur.nextSibling.nextSibling :
cur.all.tags("UL")[0]if (foldercontent.style.display=="none"){ foldercontent.style.display="" cur.style.listStyleImage="url(open.gif)" } else{ foldercontent.style.display="none" cur.style.listStyleImage="url(fold.gif)" } } }
if (ie4||ns6) document.onclick=checkcontained
//--> </script>
</head> <body MS_POSITIONING="GridLayout"> <font face="Verdana">
<ul> <li id="foldheader">News</li> <ul id="foldinglist" style="display:none" style=& {head};> <li><a href="http://www.cnn.com">CNN</a></li> <li><a href="http://www.abcnews.com">ABC News</a></li> <li><a href="http://www.news.bbc.co.uk">BBC News</a></li> </ul>
<li id="foldheader">Webmaster</li> <ul id="foldinglist" style="display:none" style=& {head};> <li><a href="http://www.dynamicdrive.com">Dynamic Drive</a></li> <li><a href="http://www.javascriptkit.com">JavaScript Kit</a></li> <li><a href="http://www.freewarejava.com">Freewarejava.com</a></li </ul>
<li id="foldheader">Nested Example</li> <ul id="foldinglist" style="display:none" style=&
{head};> <li><a href="http://www.dynamicdrive.com">outer 1</a></li> <li><a href="http://www.dynamicdrive.com">outer 2</a></li> <li id="foldheader">Nested</li> <ul id="foldinglist" style="display:none" style=& {head};> <li><a href="http://www.dynamicdrive.com">nested 1</a></li> <li><a href="http://www.dynamicdrive.com">nested 2</a></li> </ul> <li><a href="http://www.dynamicdrive.com">outer 3</a></li> <li><a href="http://www.dynamicdrive.com">outer 4</a></li> </ul> </ul>
</font>
<p align="center"><font face="Arial" size="-2">Free DHTML scripts providedby<br> <a href="http://www.dynamicdrive.com">Dynamic Drive</a></font></p> <script language="JavaScript1.2"> <!--
function get_cookie(Name) { //Get cookie routine by Shelley Powers var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) // if cookie exists if (offset != -1) { offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring
(offset, end)) } } return returnvalue; }
var foldercontentarray=new Array() var c=0
if (ns6){ for (i=0;i<document.getElementsByTagName("UL").length; i++) {if (document.getElementsByTagName("UL") [i].id=="foldinglist"){foldercontentarray[c]=document.getElementsByTagName("UL") [i]c++ } } }
if (get_cookie(window.location.pathname) != ''){ var openresults=get_cookie (window.location.pathname).split(" ") for (i=0 ; i < openresults.length ; i++){ if (ns6){ foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults [i]].previousSibling.previousSibling.style.listStyleImage="url(open.gif)" } else{ foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex - 1].style.listStyleImage="url(open.gif)" } } }
if (ns6||ie4){ var nodelength=ns6? c-1 : foldinglist.length-1 var nodes=new Array(nodelength) var openones='' }
function checkit(){ for (i=0 ; i <= nodelength ; i++){ if ((ns6&&foldercontentarray[i].style.display=='')|| (ie4&&foldinglist[i].style.display=='')) openones=openones + " " + i } document.cookie=window.location.pathname+"="+openo nes }
if (ns6||ie4) window.onunload=checkit //--> </script>
</body> </html> --------------------------------------------------------
When I compile it, or run it straight from IIS, it will not keep cookiestate for the menu selection (not-working).
When I open the webroot folder directly from the C drive (windows explorer)and dclick the .htm file, it opens and it keeps cookie state on the menus(working)
What do I have to configure in order to make this work when I run the pagefrom IIS??
Thanks!
-Todd
.
Dan,
You totally ROCK
"Dan" <da*@nospam.com> wrote in message
news:0b****************************@phx.gbl... if your machine name has an underscore in it that can also cause problems.
Dan
-----Original Message----- OK,
I created a .htm page within a new Web solution: --------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html> <head> <title>Menu</title> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"><meta name=ProgId content=VisualStudio.HTML> <meta name=Originator content="Microsoft Visual Studio .NET 7.1"> <style> <!-- #foldheader{cursor:pointer;cursor:hand ; font-
weight:bold ;list-style-image:url(fold.gif)} #foldinglist{list-style-image:url(list.gif)} //--> </style> <script language="JavaScript1.2"> <!--
//Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/02)//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com //This credit MUST stay intact for use
var head="display:''" img1=new Image() img1.src="fold.gif" img2=new Image() img2.src="open.gif"
var ns6=document.getElementById&&!document.all var ie4=document.all&&navigator.userAgent.indexOf("Ope ra") ==-1 function checkcontained(e){ var iscontained=0 cur=ns6? e.target : event.srcElement i=0 if (cur.id=="foldheader") iscontained=1 else while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){ if (cur.id=="foldheader"||cur.id=="foldinglist"){ iscontained=(cur.id=="foldheader")? 1 : 0 break } cur=ns6? cur.parentNode : cur.parentElement }
if (iscontained){ var foldercontent=ns6? cur.nextSibling.nextSibling :
cur.all.tags("UL")[0]if (foldercontent.style.display=="none"){ foldercontent.style.display="" cur.style.listStyleImage="url(open.gif)" } else{ foldercontent.style.display="none" cur.style.listStyleImage="url(fold.gif)" } } }
if (ie4||ns6) document.onclick=checkcontained
//--> </script>
</head> <body MS_POSITIONING="GridLayout"> <font face="Verdana">
<ul> <li id="foldheader">News</li> <ul id="foldinglist" style="display:none" style=& {head};> <li><a href="http://www.cnn.com">CNN</a></li> <li><a href="http://www.abcnews.com">ABC News</a></li> <li><a href="http://www.news.bbc.co.uk">BBC News</a></li> </ul>
<li id="foldheader">Webmaster</li> <ul id="foldinglist" style="display:none" style=& {head};> <li><a href="http://www.dynamicdrive.com">Dynamic Drive</a></li> <li><a href="http://www.javascriptkit.com">JavaScript Kit</a></li> <li><a href="http://www.freewarejava.com">Freewarejava.com</a></li </ul>
<li id="foldheader">Nested Example</li> <ul id="foldinglist" style="display:none" style=&
{head};> <li><a href="http://www.dynamicdrive.com">outer 1</a></li> <li><a href="http://www.dynamicdrive.com">outer 2</a></li> <li id="foldheader">Nested</li> <ul id="foldinglist" style="display:none" style=& {head};> <li><a href="http://www.dynamicdrive.com">nested 1</a></li> <li><a href="http://www.dynamicdrive.com">nested 2</a></li> </ul> <li><a href="http://www.dynamicdrive.com">outer 3</a></li> <li><a href="http://www.dynamicdrive.com">outer 4</a></li> </ul> </ul>
</font>
<p align="center"><font face="Arial" size="-2">Free DHTML scripts providedby<br> <a href="http://www.dynamicdrive.com">Dynamic Drive</a></font></p> <script language="JavaScript1.2"> <!--
function get_cookie(Name) { //Get cookie routine by Shelley Powers var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) // if cookie exists if (offset != -1) { offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring
(offset, end)) } } return returnvalue; }
var foldercontentarray=new Array() var c=0
if (ns6){ for (i=0;i<document.getElementsByTagName("UL").length; i++) {if (document.getElementsByTagName("UL") [i].id=="foldinglist"){foldercontentarray[c]=document.getElementsByTagName("UL") [i]c++ } } }
if (get_cookie(window.location.pathname) != ''){ var openresults=get_cookie (window.location.pathname).split(" ") for (i=0 ; i < openresults.length ; i++){ if (ns6){ foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults [i]].previousSibling.previousSibling.style.listStyleImage="url(open.gif)" } else{ foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex - 1].style.listStyleImage="url(open.gif)" } } }
if (ns6||ie4){ var nodelength=ns6? c-1 : foldinglist.length-1 var nodes=new Array(nodelength) var openones='' }
function checkit(){ for (i=0 ; i <= nodelength ; i++){ if ((ns6&&foldercontentarray[i].style.display=='')|| (ie4&&foldinglist[i].style.display=='')) openones=openones + " " + i } document.cookie=window.location.pathname+"="+openo nes }
if (ns6||ie4) window.onunload=checkit //--> </script>
</body> </html> --------------------------------------------------------
When I compile it, or run it straight from IIS, it will not keep cookiestate for the menu selection (not-working).
When I open the webroot folder directly from the C drive (windows explorer)and dclick the .htm file, it opens and it keeps cookie state on the menus(working)
What do I have to configure in order to make this work when I run the pagefrom IIS??
Thanks!
-Todd
.
Todd,
I meant the _cookie_ domain.
Please post the code you use to create the cookie.
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... The domain is set to my machine name (todd_sloan).
How do I change it?
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:uO**************@TK2MSFTNGP12.phx.gbl... "Todd" <ts****@smithdata.net> wrote in message news:OQ**************@TK2MSFTNGP10.phx.gbl... Yeah, I will try to hardcode the domain field path for the cookie and see if that works. If not I will just scratch everything and keep client
state on an parent IFrame or something..at least I know that works. hehe
Todd, that's not what I said.
I said, try to find out what the domain is set to, then learn to set it the right way.
How are you setting it now? -- John Saunders Internet Engineer jo***********@surfcontrol.com
Todd,
I meant the _cookie_ domain.
Please post the code you use to create the cookie.
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... The domain is set to my machine name (todd_sloan).
How do I change it?
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:uO**************@TK2MSFTNGP12.phx.gbl... "Todd" <ts****@smithdata.net> wrote in message news:OQ**************@TK2MSFTNGP10.phx.gbl... Yeah, I will try to hardcode the domain field path for the cookie and see if that works. If not I will just scratch everything and keep client
state on an parent IFrame or something..at least I know that works. hehe
Todd, that's not what I said.
I said, try to find out what the domain is set to, then learn to set it the right way.
How are you setting it now? -- John Saunders Internet Engineer jo***********@surfcontrol.com
<script language="JavaScript1.2">
<!--
function get_cookie(Name) {
//Get cookie routine by Shelley Powers
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
// if cookie exists
if (offset != -1) {
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(off set, end))
}
}
return returnvalue;
}
var foldercontentarray=new Array()
var c=0
if (ns6){
for (i=0;i<document.getElementsByTagName("UL").length; i++){
if (document.getElementsByTagName("UL")[i].id=="foldinglist"){
foldercontentarray[c]=document.getElementsByTagName("UL")[i]
c++
}
}
}
if (get_cookie(window.location.pathname) != ''){
var openresults=get_cookie(window.location.pathname).s plit(" ")
for (i=0 ; i < openresults.length ; i++){
if (ns6){
foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis
tStyleImage="url(open.gif)"
}
else{
foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag
e="url(open.gif)"
}
}
}
if (ns6||ie4){
var nodelength=ns6? c-1 : foldinglist.length-1
var nodes=new Array(nodelength)
var openones=''
}
function checkit(){
for (i=0 ; i <= nodelength ; i++){
if
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style.
display==''))
openones=openones + " " + i
}
document.cookie=window.location.pathname+"="+openo nes
}
if (ns6||ie4)
window.onunload=checkit
//-->
</script>
"John Saunders" <jo***********@surfcontrol.com> wrote in message
news:u%****************@TK2MSFTNGP09.phx.gbl... Todd,
I meant the _cookie_ domain.
Please post the code you use to create the cookie.
-- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... The domain is set to my machine name (todd_sloan).
How do I change it?
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:uO**************@TK2MSFTNGP12.phx.gbl... "Todd" <ts****@smithdata.net> wrote in message news:OQ**************@TK2MSFTNGP10.phx.gbl... > Yeah, I will try to hardcode the domain field path for the cookie
and see if > that works. If not I will just scratch everything and keep client state on > an parent IFrame or something..at least I know that works. > hehe
Todd, that's not what I said.
I said, try to find out what the domain is set to, then learn to set
it the right way.
How are you setting it now? -- John Saunders Internet Engineer jo***********@surfcontrol.com
<script language="JavaScript1.2">
<!--
function get_cookie(Name) {
//Get cookie routine by Shelley Powers
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
// if cookie exists
if (offset != -1) {
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(off set, end))
}
}
return returnvalue;
}
var foldercontentarray=new Array()
var c=0
if (ns6){
for (i=0;i<document.getElementsByTagName("UL").length; i++){
if (document.getElementsByTagName("UL")[i].id=="foldinglist"){
foldercontentarray[c]=document.getElementsByTagName("UL")[i]
c++
}
}
}
if (get_cookie(window.location.pathname) != ''){
var openresults=get_cookie(window.location.pathname).s plit(" ")
for (i=0 ; i < openresults.length ; i++){
if (ns6){
foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis
tStyleImage="url(open.gif)"
}
else{
foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag
e="url(open.gif)"
}
}
}
if (ns6||ie4){
var nodelength=ns6? c-1 : foldinglist.length-1
var nodes=new Array(nodelength)
var openones=''
}
function checkit(){
for (i=0 ; i <= nodelength ; i++){
if
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style.
display==''))
openones=openones + " " + i
}
document.cookie=window.location.pathname+"="+openo nes
}
if (ns6||ie4)
window.onunload=checkit
//-->
</script>
"John Saunders" <jo***********@surfcontrol.com> wrote in message
news:u%****************@TK2MSFTNGP09.phx.gbl... Todd,
I meant the _cookie_ domain.
Please post the code you use to create the cookie.
-- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... The domain is set to my machine name (todd_sloan).
How do I change it?
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:uO**************@TK2MSFTNGP12.phx.gbl... "Todd" <ts****@smithdata.net> wrote in message news:OQ**************@TK2MSFTNGP10.phx.gbl... > Yeah, I will try to hardcode the domain field path for the cookie
and see if > that works. If not I will just scratch everything and keep client state on > an parent IFrame or something..at least I know that works. > hehe
Todd, that's not what I said.
I said, try to find out what the domain is set to, then learn to set
it the right way.
How are you setting it now? -- John Saunders Internet Engineer jo***********@surfcontrol.com
Todd, what is window.location.pathname in the case where it works and the
case where it does not work?
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message
news:uI**************@TK2MSFTNGP12.phx.gbl... <script language="JavaScript1.2"> <!--
function get_cookie(Name) { //Get cookie routine by Shelley Powers var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) // if cookie exists if (offset != -1) { offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(off set, end)) } } return returnvalue; }
var foldercontentarray=new Array() var c=0
if (ns6){ for (i=0;i<document.getElementsByTagName("UL").length; i++){ if (document.getElementsByTagName("UL")[i].id=="foldinglist"){ foldercontentarray[c]=document.getElementsByTagName("UL")[i] c++ } } }
if (get_cookie(window.location.pathname) != ''){ var openresults=get_cookie(window.location.pathname).s plit(" ") for (i=0 ; i < openresults.length ; i++){ if (ns6){ foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis tStyleImage="url(open.gif)" } else{ foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag e="url(open.gif)" } } }
if (ns6||ie4){ var nodelength=ns6? c-1 : foldinglist.length-1 var nodes=new Array(nodelength) var openones='' }
function checkit(){ for (i=0 ; i <= nodelength ; i++){ if
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style. display=='')) openones=openones + " " + i } document.cookie=window.location.pathname+"="+openo nes }
if (ns6||ie4) window.onunload=checkit //--> </script>
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:u%****************@TK2MSFTNGP09.phx.gbl... Todd,
I meant the _cookie_ domain.
Please post the code you use to create the cookie.
-- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... The domain is set to my machine name (todd_sloan).
How do I change it?
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:uO**************@TK2MSFTNGP12.phx.gbl... > "Todd" <ts****@smithdata.net> wrote in message > news:OQ**************@TK2MSFTNGP10.phx.gbl... > > Yeah, I will try to hardcode the domain field path for the cookie and see > if > > that works. If not I will just scratch everything and keep client state on > > an parent IFrame or something..at least I know that works. > > hehe > > Todd, that's not what I said. > > I said, try to find out what the domain is set to, then learn to set it the > right way. > > How are you setting it now? > -- > John Saunders > Internet Engineer > jo***********@surfcontrol.com > > >
Todd, what is window.location.pathname in the case where it works and the
case where it does not work?
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message
news:uI**************@TK2MSFTNGP12.phx.gbl... <script language="JavaScript1.2"> <!--
function get_cookie(Name) { //Get cookie routine by Shelley Powers var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) // if cookie exists if (offset != -1) { offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(off set, end)) } } return returnvalue; }
var foldercontentarray=new Array() var c=0
if (ns6){ for (i=0;i<document.getElementsByTagName("UL").length; i++){ if (document.getElementsByTagName("UL")[i].id=="foldinglist"){ foldercontentarray[c]=document.getElementsByTagName("UL")[i] c++ } } }
if (get_cookie(window.location.pathname) != ''){ var openresults=get_cookie(window.location.pathname).s plit(" ") for (i=0 ; i < openresults.length ; i++){ if (ns6){ foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis tStyleImage="url(open.gif)" } else{ foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag e="url(open.gif)" } } }
if (ns6||ie4){ var nodelength=ns6? c-1 : foldinglist.length-1 var nodes=new Array(nodelength) var openones='' }
function checkit(){ for (i=0 ; i <= nodelength ; i++){ if
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style. display=='')) openones=openones + " " + i } document.cookie=window.location.pathname+"="+openo nes }
if (ns6||ie4) window.onunload=checkit //--> </script>
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:u%****************@TK2MSFTNGP09.phx.gbl... Todd,
I meant the _cookie_ domain.
Please post the code you use to create the cookie.
-- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... The domain is set to my machine name (todd_sloan).
How do I change it?
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:uO**************@TK2MSFTNGP12.phx.gbl... > "Todd" <ts****@smithdata.net> wrote in message > news:OQ**************@TK2MSFTNGP10.phx.gbl... > > Yeah, I will try to hardcode the domain field path for the cookie and see > if > > that works. If not I will just scratch everything and keep client state on > > an parent IFrame or something..at least I know that works. > > hehe > > Todd, that's not what I said. > > I said, try to find out what the domain is set to, then learn to set it the > right way. > > How are you setting it now? > -- > John Saunders > Internet Engineer > jo***********@surfcontrol.com > > >
Todd, I think someone posted in this thread that there is a problem with
cookies and hosts with underscore in the name...
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... It is the same for both:
"MyWebProject/Menu.htm"
It works great when I type http://localhost/MyWebProject/Menu.htm into the Browser.
If does not work when I type http://todd_sloan/MyWebProject/Menu.htm into the Browser.
Odd?
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:uO**************@TK2MSFTNGP09.phx.gbl... Todd, what is window.location.pathname in the case where it works and
the case where it does not work?
-- John Saunders Internet Engineer jo***********@surfcontrol.com -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message news:uI**************@TK2MSFTNGP12.phx.gbl... <script language="JavaScript1.2"> <!--
function get_cookie(Name) { //Get cookie routine by Shelley Powers var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) // if cookie exists if (offset != -1) { offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(off set, end)) } } return returnvalue; }
var foldercontentarray=new Array() var c=0
if (ns6){ for (i=0;i<document.getElementsByTagName("UL").length; i++){ if (document.getElementsByTagName("UL")[i].id=="foldinglist"){ foldercontentarray[c]=document.getElementsByTagName("UL")[i] c++ } } }
if (get_cookie(window.location.pathname) != ''){ var openresults=get_cookie(window.location.pathname).s plit(" ") for (i=0 ; i < openresults.length ; i++){ if (ns6){ foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis tStyleImage="url(open.gif)" } else{ foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag e="url(open.gif)" } } }
if (ns6||ie4){ var nodelength=ns6? c-1 : foldinglist.length-1 var nodes=new Array(nodelength) var openones='' }
function checkit(){ for (i=0 ; i <= nodelength ; i++){ if
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style. display=='')) openones=openones + " " + i } document.cookie=window.location.pathname+"="+openo nes }
if (ns6||ie4) window.onunload=checkit //--> </script>
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:u%****************@TK2MSFTNGP09.phx.gbl... > Todd, > > I meant the _cookie_ domain. > > Please post the code you use to create the cookie. > > -- > John Saunders > Internet Engineer > jo***********@surfcontrol.com > > > "Todd" <ts****@smithdata.net> wrote in message > news:%2****************@TK2MSFTNGP12.phx.gbl... > > The domain is set to my machine name (todd_sloan). > > > > How do I change it? > > > > > > "John Saunders" <jo***********@surfcontrol.com> wrote in message > > news:uO**************@TK2MSFTNGP12.phx.gbl... > > > "Todd" <ts****@smithdata.net> wrote in message > > > news:OQ**************@TK2MSFTNGP10.phx.gbl... > > > > Yeah, I will try to hardcode the domain field path for the cookie and > > see > > > if > > > > that works. If not I will just scratch everything and keep client > state > > on > > > > an parent IFrame or something..at least I know that works. > > > > hehe > > > > > > Todd, that's not what I said. > > > > > > I said, try to find out what the domain is set to, then learn to set it > > the > > > right way. > > > > > > How are you setting it now? > > > -- > > > John Saunders > > > Internet Engineer > > > jo***********@surfcontrol.com > > > > > > > > > > > > > > >
Todd, I think someone posted in this thread that there is a problem with
cookies and hosts with underscore in the name...
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... It is the same for both:
"MyWebProject/Menu.htm"
It works great when I type http://localhost/MyWebProject/Menu.htm into the Browser.
If does not work when I type http://todd_sloan/MyWebProject/Menu.htm into the Browser.
Odd?
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:uO**************@TK2MSFTNGP09.phx.gbl... Todd, what is window.location.pathname in the case where it works and
the case where it does not work?
-- John Saunders Internet Engineer jo***********@surfcontrol.com -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message news:uI**************@TK2MSFTNGP12.phx.gbl... <script language="JavaScript1.2"> <!--
function get_cookie(Name) { //Get cookie routine by Shelley Powers var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) // if cookie exists if (offset != -1) { offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(off set, end)) } } return returnvalue; }
var foldercontentarray=new Array() var c=0
if (ns6){ for (i=0;i<document.getElementsByTagName("UL").length; i++){ if (document.getElementsByTagName("UL")[i].id=="foldinglist"){ foldercontentarray[c]=document.getElementsByTagName("UL")[i] c++ } } }
if (get_cookie(window.location.pathname) != ''){ var openresults=get_cookie(window.location.pathname).s plit(" ") for (i=0 ; i < openresults.length ; i++){ if (ns6){ foldercontentarray[openresults[i]].style.display=''
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis tStyleImage="url(open.gif)" } else{ foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag e="url(open.gif)" } } }
if (ns6||ie4){ var nodelength=ns6? c-1 : foldinglist.length-1 var nodes=new Array(nodelength) var openones='' }
function checkit(){ for (i=0 ; i <= nodelength ; i++){ if
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style. display=='')) openones=openones + " " + i } document.cookie=window.location.pathname+"="+openo nes }
if (ns6||ie4) window.onunload=checkit //--> </script>
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:u%****************@TK2MSFTNGP09.phx.gbl... > Todd, > > I meant the _cookie_ domain. > > Please post the code you use to create the cookie. > > -- > John Saunders > Internet Engineer > jo***********@surfcontrol.com > > > "Todd" <ts****@smithdata.net> wrote in message > news:%2****************@TK2MSFTNGP12.phx.gbl... > > The domain is set to my machine name (todd_sloan). > > > > How do I change it? > > > > > > "John Saunders" <jo***********@surfcontrol.com> wrote in message > > news:uO**************@TK2MSFTNGP12.phx.gbl... > > > "Todd" <ts****@smithdata.net> wrote in message > > > news:OQ**************@TK2MSFTNGP10.phx.gbl... > > > > Yeah, I will try to hardcode the domain field path for the cookie and > > see > > > if > > > > that works. If not I will just scratch everything and keep client > state > > on > > > > an parent IFrame or something..at least I know that works. > > > > hehe > > > > > > Todd, that's not what I said. > > > > > > I said, try to find out what the domain is set to, then learn to set it > > the > > > right way. > > > > > > How are you setting it now? > > > -- > > > John Saunders > > > Internet Engineer > > > jo***********@surfcontrol.com > > > > > > > > > > > > > > >
Got it working!
Yeah I have like 10-15 different aspx pages all sharing the same .htm menu
() and what it was doing was creating a cookie for the menu state on each
aspx. page...hehe
So I forced the cookie to be created in one page, in the IFrame's parent,
and then hardcoded the window.location.pathname
("/ClerkOfCourt/CourtIndexing/MainNavigator.aspx")
<script language="JavaScript">
<!--
function get_cookie(Name)
{
var search = Name + "="
var returnvalue = "";
if (parent.document.cookie.length > 0)
{
offset = parent.document.cookie.indexOf(search)
// if cookie exists
if (offset != -1)
{
offset += search.length
// set index of beginning of value
end = parent.document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1) end = parent.document.cookie.length;
returnvalue=unescape(parent.document.cookie.substr ing(offset, end))
}
}
return returnvalue;
}
var foldercontentarray=new Array()
var c=0
if (get_cookie("/ClerkOfCourt/CourtIndexing/MainNavigator.aspx") != '')
{
var
openresults=get_cookie("/ClerkOfCourt/CourtIndexing/MainNavigator.aspx").spl
it(" ")
for (i=0 ; i < openresults.length ; i++)
{
if (ns6)
{
foldercontentarray[openresults[i]].style.display=''
}
else
{
foldinglist[openresults[i]].style.display=''
}
}
}
if (ns6||ie4)
{
var nodelength=ns6? c-1 : foldinglist.length-1
var nodes=new Array(nodelength)
var openones=''
}
function checkit()
{
for (i=0 ; i <= nodelength ; i++)
{
if
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style.
display==''))
openones=openones + " " + i
}
//parent.document.cookie=window.location.pathname+"= "+openones
parent.document.cookie="/ClerkOfCourt/CourtIndexing/MainNavigator.aspx="+ope
nones
alert(parent.document.cookie)
}
if (ns6||ie4)
window.onunload=checkit
//-->
</script>
Working like a champ now.
Thanks for all the help John. You pointed me in the right direction. Voice
of reason..
hehe
-T
"John Saunders" <jo***********@surfcontrol.com> wrote in message
news:Ol**************@TK2MSFTNGP12.phx.gbl... Todd, I think someone posted in this thread that there is a problem with cookies and hosts with underscore in the name... -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... It is the same for both:
"MyWebProject/Menu.htm"
It works great when I type http://localhost/MyWebProject/Menu.htm into
the Browser.
If does not work when I type http://todd_sloan/MyWebProject/Menu.htm
into the Browser.
Odd?
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:uO**************@TK2MSFTNGP09.phx.gbl... Todd, what is window.location.pathname in the case where it works and the case where it does not work?
-- John Saunders Internet Engineer jo***********@surfcontrol.com -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message news:uI**************@TK2MSFTNGP12.phx.gbl... > <script language="JavaScript1.2"> > <!-- > > function get_cookie(Name) { > //Get cookie routine by Shelley Powers > var search = Name + "=" > var returnvalue = ""; > if (document.cookie.length > 0) { > offset = document.cookie.indexOf(search) > // if cookie exists > if (offset != -1) { > offset += search.length > // set index of beginning of value > end = document.cookie.indexOf(";", offset); > // set index of end of cookie value > if (end == -1) end = document.cookie.length; > returnvalue=unescape(document.cookie.substring(off set, end)) > } > } > return returnvalue; > } > > var foldercontentarray=new Array() > var c=0 > > if (ns6){ > for (i=0;i<document.getElementsByTagName("UL").length; i++){ > if (document.getElementsByTagName("UL")[i].id=="foldinglist"){ > foldercontentarray[c]=document.getElementsByTagName("UL")[i] > c++ > } > } > } > > if (get_cookie(window.location.pathname) != ''){ > var openresults=get_cookie(window.location.pathname).s plit(" ") > for (i=0 ; i < openresults.length ; i++){ > if (ns6){ > foldercontentarray[openresults[i]].style.display='' > >
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis > tStyleImage="url(open.gif)" > } > else{ > foldinglist[openresults[i]].style.display='' > > > > >
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag > e="url(open.gif)" > } > } > } > > if (ns6||ie4){ > var nodelength=ns6? c-1 : foldinglist.length-1 > var nodes=new Array(nodelength) > var openones='' > } > > function checkit(){ > for (i=0 ; i <= nodelength ; i++){ > if >
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style. > display=='')) > openones=openones + " " + i > } > document.cookie=window.location.pathname+"="+openo nes > } > > if (ns6||ie4) > window.onunload=checkit > //--> > </script> > > > "John Saunders" <jo***********@surfcontrol.com> wrote in message > news:u%****************@TK2MSFTNGP09.phx.gbl... > > Todd, > > > > I meant the _cookie_ domain. > > > > Please post the code you use to create the cookie. > > > > -- > > John Saunders > > Internet Engineer > > jo***********@surfcontrol.com > > > > > > "Todd" <ts****@smithdata.net> wrote in message > > news:%2****************@TK2MSFTNGP12.phx.gbl... > > > The domain is set to my machine name (todd_sloan). > > > > > > How do I change it? > > > > > > > > > "John Saunders" <jo***********@surfcontrol.com> wrote in message > > > news:uO**************@TK2MSFTNGP12.phx.gbl... > > > > "Todd" <ts****@smithdata.net> wrote in message > > > > news:OQ**************@TK2MSFTNGP10.phx.gbl... > > > > > Yeah, I will try to hardcode the domain field path for the cookie > and > > > see > > > > if > > > > > that works. If not I will just scratch everything and keep client > > state > > > on > > > > > an parent IFrame or something..at least I know that works. > > > > > hehe > > > > > > > > Todd, that's not what I said. > > > > > > > > I said, try to find out what the domain is set to, then learn
to set > it > > > the > > > > right way. > > > > > > > > How are you setting it now? > > > > -- > > > > John Saunders > > > > Internet Engineer > > > > jo***********@surfcontrol.com > > > > > > > > > > > > > > > > > > > > > > > >
Got it working!
Yeah I have like 10-15 different aspx pages all sharing the same .htm menu
() and what it was doing was creating a cookie for the menu state on each
aspx. page...hehe
So I forced the cookie to be created in one page, in the IFrame's parent,
and then hardcoded the window.location.pathname
("/ClerkOfCourt/CourtIndexing/MainNavigator.aspx")
<script language="JavaScript">
<!--
function get_cookie(Name)
{
var search = Name + "="
var returnvalue = "";
if (parent.document.cookie.length > 0)
{
offset = parent.document.cookie.indexOf(search)
// if cookie exists
if (offset != -1)
{
offset += search.length
// set index of beginning of value
end = parent.document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1) end = parent.document.cookie.length;
returnvalue=unescape(parent.document.cookie.substr ing(offset, end))
}
}
return returnvalue;
}
var foldercontentarray=new Array()
var c=0
if (get_cookie("/ClerkOfCourt/CourtIndexing/MainNavigator.aspx") != '')
{
var
openresults=get_cookie("/ClerkOfCourt/CourtIndexing/MainNavigator.aspx").spl
it(" ")
for (i=0 ; i < openresults.length ; i++)
{
if (ns6)
{
foldercontentarray[openresults[i]].style.display=''
}
else
{
foldinglist[openresults[i]].style.display=''
}
}
}
if (ns6||ie4)
{
var nodelength=ns6? c-1 : foldinglist.length-1
var nodes=new Array(nodelength)
var openones=''
}
function checkit()
{
for (i=0 ; i <= nodelength ; i++)
{
if
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style.
display==''))
openones=openones + " " + i
}
//parent.document.cookie=window.location.pathname+"= "+openones
parent.document.cookie="/ClerkOfCourt/CourtIndexing/MainNavigator.aspx="+ope
nones
alert(parent.document.cookie)
}
if (ns6||ie4)
window.onunload=checkit
//-->
</script>
Working like a champ now.
Thanks for all the help John. You pointed me in the right direction. Voice
of reason..
hehe
-T
"John Saunders" <jo***********@surfcontrol.com> wrote in message
news:Ol**************@TK2MSFTNGP12.phx.gbl... Todd, I think someone posted in this thread that there is a problem with cookies and hosts with underscore in the name... -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... It is the same for both:
"MyWebProject/Menu.htm"
It works great when I type http://localhost/MyWebProject/Menu.htm into
the Browser.
If does not work when I type http://todd_sloan/MyWebProject/Menu.htm
into the Browser.
Odd?
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:uO**************@TK2MSFTNGP09.phx.gbl... Todd, what is window.location.pathname in the case where it works and the case where it does not work?
-- John Saunders Internet Engineer jo***********@surfcontrol.com -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message news:uI**************@TK2MSFTNGP12.phx.gbl... > <script language="JavaScript1.2"> > <!-- > > function get_cookie(Name) { > //Get cookie routine by Shelley Powers > var search = Name + "=" > var returnvalue = ""; > if (document.cookie.length > 0) { > offset = document.cookie.indexOf(search) > // if cookie exists > if (offset != -1) { > offset += search.length > // set index of beginning of value > end = document.cookie.indexOf(";", offset); > // set index of end of cookie value > if (end == -1) end = document.cookie.length; > returnvalue=unescape(document.cookie.substring(off set, end)) > } > } > return returnvalue; > } > > var foldercontentarray=new Array() > var c=0 > > if (ns6){ > for (i=0;i<document.getElementsByTagName("UL").length; i++){ > if (document.getElementsByTagName("UL")[i].id=="foldinglist"){ > foldercontentarray[c]=document.getElementsByTagName("UL")[i] > c++ > } > } > } > > if (get_cookie(window.location.pathname) != ''){ > var openresults=get_cookie(window.location.pathname).s plit(" ") > for (i=0 ; i < openresults.length ; i++){ > if (ns6){ > foldercontentarray[openresults[i]].style.display='' > >
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis > tStyleImage="url(open.gif)" > } > else{ > foldinglist[openresults[i]].style.display='' > > > > >
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag > e="url(open.gif)" > } > } > } > > if (ns6||ie4){ > var nodelength=ns6? c-1 : foldinglist.length-1 > var nodes=new Array(nodelength) > var openones='' > } > > function checkit(){ > for (i=0 ; i <= nodelength ; i++){ > if >
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style. > display=='')) > openones=openones + " " + i > } > document.cookie=window.location.pathname+"="+openo nes > } > > if (ns6||ie4) > window.onunload=checkit > //--> > </script> > > > "John Saunders" <jo***********@surfcontrol.com> wrote in message > news:u%****************@TK2MSFTNGP09.phx.gbl... > > Todd, > > > > I meant the _cookie_ domain. > > > > Please post the code you use to create the cookie. > > > > -- > > John Saunders > > Internet Engineer > > jo***********@surfcontrol.com > > > > > > "Todd" <ts****@smithdata.net> wrote in message > > news:%2****************@TK2MSFTNGP12.phx.gbl... > > > The domain is set to my machine name (todd_sloan). > > > > > > How do I change it? > > > > > > > > > "John Saunders" <jo***********@surfcontrol.com> wrote in message > > > news:uO**************@TK2MSFTNGP12.phx.gbl... > > > > "Todd" <ts****@smithdata.net> wrote in message > > > > news:OQ**************@TK2MSFTNGP10.phx.gbl... > > > > > Yeah, I will try to hardcode the domain field path for the cookie > and > > > see > > > > if > > > > > that works. If not I will just scratch everything and keep client > > state > > > on > > > > > an parent IFrame or something..at least I know that works. > > > > > hehe > > > > > > > > Todd, that's not what I said. > > > > > > > > I said, try to find out what the domain is set to, then learn
to set > it > > > the > > > > right way. > > > > > > > > How are you setting it now? > > > > -- > > > > John Saunders > > > > Internet Engineer > > > > jo***********@surfcontrol.com > > > > > > > > > > > > > > > > > > > > > > > >
Good job John.
"John Saunders" <jo***********@surfcontrol.com> wrote in message
news:Ol**************@TK2MSFTNGP12.phx.gbl... Todd, I think someone posted in this thread that there is a problem with cookies and hosts with underscore in the name... -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... It is the same for both:
"MyWebProject/Menu.htm"
It works great when I type http://localhost/MyWebProject/Menu.htm into
the Browser.
If does not work when I type http://todd_sloan/MyWebProject/Menu.htm
into the Browser.
Odd?
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:uO**************@TK2MSFTNGP09.phx.gbl... Todd, what is window.location.pathname in the case where it works and the case where it does not work?
-- John Saunders Internet Engineer jo***********@surfcontrol.com -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message news:uI**************@TK2MSFTNGP12.phx.gbl... > <script language="JavaScript1.2"> > <!-- > > function get_cookie(Name) { > //Get cookie routine by Shelley Powers > var search = Name + "=" > var returnvalue = ""; > if (document.cookie.length > 0) { > offset = document.cookie.indexOf(search) > // if cookie exists > if (offset != -1) { > offset += search.length > // set index of beginning of value > end = document.cookie.indexOf(";", offset); > // set index of end of cookie value > if (end == -1) end = document.cookie.length; > returnvalue=unescape(document.cookie.substring(off set, end)) > } > } > return returnvalue; > } > > var foldercontentarray=new Array() > var c=0 > > if (ns6){ > for (i=0;i<document.getElementsByTagName("UL").length; i++){ > if (document.getElementsByTagName("UL")[i].id=="foldinglist"){ > foldercontentarray[c]=document.getElementsByTagName("UL")[i] > c++ > } > } > } > > if (get_cookie(window.location.pathname) != ''){ > var openresults=get_cookie(window.location.pathname).s plit(" ") > for (i=0 ; i < openresults.length ; i++){ > if (ns6){ > foldercontentarray[openresults[i]].style.display='' > >
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis > tStyleImage="url(open.gif)" > } > else{ > foldinglist[openresults[i]].style.display='' > > > > >
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag > e="url(open.gif)" > } > } > } > > if (ns6||ie4){ > var nodelength=ns6? c-1 : foldinglist.length-1 > var nodes=new Array(nodelength) > var openones='' > } > > function checkit(){ > for (i=0 ; i <= nodelength ; i++){ > if >
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style. > display=='')) > openones=openones + " " + i > } > document.cookie=window.location.pathname+"="+openo nes > } > > if (ns6||ie4) > window.onunload=checkit > //--> > </script> > > > "John Saunders" <jo***********@surfcontrol.com> wrote in message > news:u%****************@TK2MSFTNGP09.phx.gbl... > > Todd, > > > > I meant the _cookie_ domain. > > > > Please post the code you use to create the cookie. > > > > -- > > John Saunders > > Internet Engineer > > jo***********@surfcontrol.com > > > > > > "Todd" <ts****@smithdata.net> wrote in message > > news:%2****************@TK2MSFTNGP12.phx.gbl... > > > The domain is set to my machine name (todd_sloan). > > > > > > How do I change it? > > > > > > > > > "John Saunders" <jo***********@surfcontrol.com> wrote in message > > > news:uO**************@TK2MSFTNGP12.phx.gbl... > > > > "Todd" <ts****@smithdata.net> wrote in message > > > > news:OQ**************@TK2MSFTNGP10.phx.gbl... > > > > > Yeah, I will try to hardcode the domain field path for the cookie > and > > > see > > > > if > > > > > that works. If not I will just scratch everything and keep client > > state > > > on > > > > > an parent IFrame or something..at least I know that works. > > > > > hehe > > > > > > > > Todd, that's not what I said. > > > > > > > > I said, try to find out what the domain is set to, then learn
to set > it > > > the > > > > right way. > > > > > > > > How are you setting it now? > > > > -- > > > > John Saunders > > > > Internet Engineer > > > > jo***********@surfcontrol.com > > > > > > > > > > > > > > > > > > > > > > > >
Good job John.
"John Saunders" <jo***********@surfcontrol.com> wrote in message
news:Ol**************@TK2MSFTNGP12.phx.gbl... Todd, I think someone posted in this thread that there is a problem with cookies and hosts with underscore in the name... -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... It is the same for both:
"MyWebProject/Menu.htm"
It works great when I type http://localhost/MyWebProject/Menu.htm into
the Browser.
If does not work when I type http://todd_sloan/MyWebProject/Menu.htm
into the Browser.
Odd?
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:uO**************@TK2MSFTNGP09.phx.gbl... Todd, what is window.location.pathname in the case where it works and the case where it does not work?
-- John Saunders Internet Engineer jo***********@surfcontrol.com -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message news:uI**************@TK2MSFTNGP12.phx.gbl... > <script language="JavaScript1.2"> > <!-- > > function get_cookie(Name) { > //Get cookie routine by Shelley Powers > var search = Name + "=" > var returnvalue = ""; > if (document.cookie.length > 0) { > offset = document.cookie.indexOf(search) > // if cookie exists > if (offset != -1) { > offset += search.length > // set index of beginning of value > end = document.cookie.indexOf(";", offset); > // set index of end of cookie value > if (end == -1) end = document.cookie.length; > returnvalue=unescape(document.cookie.substring(off set, end)) > } > } > return returnvalue; > } > > var foldercontentarray=new Array() > var c=0 > > if (ns6){ > for (i=0;i<document.getElementsByTagName("UL").length; i++){ > if (document.getElementsByTagName("UL")[i].id=="foldinglist"){ > foldercontentarray[c]=document.getElementsByTagName("UL")[i] > c++ > } > } > } > > if (get_cookie(window.location.pathname) != ''){ > var openresults=get_cookie(window.location.pathname).s plit(" ") > for (i=0 ; i < openresults.length ; i++){ > if (ns6){ > foldercontentarray[openresults[i]].style.display='' > >
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis > tStyleImage="url(open.gif)" > } > else{ > foldinglist[openresults[i]].style.display='' > > > > >
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag > e="url(open.gif)" > } > } > } > > if (ns6||ie4){ > var nodelength=ns6? c-1 : foldinglist.length-1 > var nodes=new Array(nodelength) > var openones='' > } > > function checkit(){ > for (i=0 ; i <= nodelength ; i++){ > if >
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style. > display=='')) > openones=openones + " " + i > } > document.cookie=window.location.pathname+"="+openo nes > } > > if (ns6||ie4) > window.onunload=checkit > //--> > </script> > > > "John Saunders" <jo***********@surfcontrol.com> wrote in message > news:u%****************@TK2MSFTNGP09.phx.gbl... > > Todd, > > > > I meant the _cookie_ domain. > > > > Please post the code you use to create the cookie. > > > > -- > > John Saunders > > Internet Engineer > > jo***********@surfcontrol.com > > > > > > "Todd" <ts****@smithdata.net> wrote in message > > news:%2****************@TK2MSFTNGP12.phx.gbl... > > > The domain is set to my machine name (todd_sloan). > > > > > > How do I change it? > > > > > > > > > "John Saunders" <jo***********@surfcontrol.com> wrote in message > > > news:uO**************@TK2MSFTNGP12.phx.gbl... > > > > "Todd" <ts****@smithdata.net> wrote in message > > > > news:OQ**************@TK2MSFTNGP10.phx.gbl... > > > > > Yeah, I will try to hardcode the domain field path for the cookie > and > > > see > > > > if > > > > > that works. If not I will just scratch everything and keep client > > state > > > on > > > > > an parent IFrame or something..at least I know that works. > > > > > hehe > > > > > > > > Todd, that's not what I said. > > > > > > > > I said, try to find out what the domain is set to, then learn
to set > it > > > the > > > > right way. > > > > > > > > How are you setting it now? > > > > -- > > > > John Saunders > > > > Internet Engineer > > > > jo***********@surfcontrol.com > > > > > > > > > > > > > > > > > > > > > > > >
Yeah, I guess if you spend enough time debugging your own cookie errors, you
can sometimes help some else with theirs. :-)
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
"MS News (MS ILM)" <sq**********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Good job John.
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:Ol**************@TK2MSFTNGP12.phx.gbl... Todd, I think someone posted in this thread that there is a problem with cookies and hosts with underscore in the name... -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... It is the same for both:
"MyWebProject/Menu.htm"
It works great when I type http://localhost/MyWebProject/Menu.htm into the Browser.
If does not work when I type http://todd_sloan/MyWebProject/Menu.htm into the Browser.
Odd?
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:uO**************@TK2MSFTNGP09.phx.gbl... > Todd, what is window.location.pathname in the case where it works
and the > case where it does not work? > > > -- > John Saunders > Internet Engineer > jo***********@surfcontrol.com > > > > -- > John Saunders > Internet Engineer > jo***********@surfcontrol.com > > > "Todd" <ts****@smithdata.net> wrote in message > news:uI**************@TK2MSFTNGP12.phx.gbl... > > <script language="JavaScript1.2"> > > <!-- > > > > function get_cookie(Name) { > > //Get cookie routine by Shelley Powers > > var search = Name + "=" > > var returnvalue = ""; > > if (document.cookie.length > 0) { > > offset = document.cookie.indexOf(search) > > // if cookie exists > > if (offset != -1) { > > offset += search.length > > // set index of beginning of value > > end = document.cookie.indexOf(";", offset); > > // set index of end of cookie value > > if (end == -1) end = document.cookie.length; > > returnvalue=unescape(document.cookie.substring(off set, end)) > > } > > } > > return returnvalue; > > } > > > > var foldercontentarray=new Array() > > var c=0 > > > > if (ns6){ > > for (i=0;i<document.getElementsByTagName("UL").length; i++){ > > if (document.getElementsByTagName("UL")[i].id=="foldinglist"){ > > foldercontentarray[c]=document.getElementsByTagName("UL")[i] > > c++ > > } > > } > > } > > > > if (get_cookie(window.location.pathname) != ''){ > > var openresults=get_cookie(window.location.pathname).s plit(" ") > > for (i=0 ; i < openresults.length ; i++){ > > if (ns6){ > > foldercontentarray[openresults[i]].style.display='' > > > > >
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis > > tStyleImage="url(open.gif)" > > } > > else{ > > foldinglist[openresults[i]].style.display='' > > > > > > > > > > >
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag > > e="url(open.gif)" > > } > > } > > } > > > > if (ns6||ie4){ > > var nodelength=ns6? c-1 : foldinglist.length-1 > > var nodes=new Array(nodelength) > > var openones='' > > } > > > > function checkit(){ > > for (i=0 ; i <= nodelength ; i++){ > > if > > >
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style. > > display=='')) > > openones=openones + " " + i > > } > > document.cookie=window.location.pathname+"="+openo nes > > } > > > > if (ns6||ie4) > > window.onunload=checkit > > //--> > > </script> > > > > > > "John Saunders" <jo***********@surfcontrol.com> wrote in message > > news:u%****************@TK2MSFTNGP09.phx.gbl... > > > Todd, > > > > > > I meant the _cookie_ domain. > > > > > > Please post the code you use to create the cookie. > > > > > > -- > > > John Saunders > > > Internet Engineer > > > jo***********@surfcontrol.com > > > > > > > > > "Todd" <ts****@smithdata.net> wrote in message > > > news:%2****************@TK2MSFTNGP12.phx.gbl... > > > > The domain is set to my machine name (todd_sloan). > > > > > > > > How do I change it? > > > > > > > > > > > > "John Saunders" <jo***********@surfcontrol.com> wrote in
message > > > > news:uO**************@TK2MSFTNGP12.phx.gbl... > > > > > "Todd" <ts****@smithdata.net> wrote in message > > > > > news:OQ**************@TK2MSFTNGP10.phx.gbl... > > > > > > Yeah, I will try to hardcode the domain field path for the cookie > > and > > > > see > > > > > if > > > > > > that works. If not I will just scratch everything and keep client > > > state > > > > on > > > > > > an parent IFrame or something..at least I know that works. > > > > > > hehe > > > > > > > > > > Todd, that's not what I said. > > > > > > > > > > I said, try to find out what the domain is set to, then
learn to set > > it > > > > the > > > > > right way. > > > > > > > > > > How are you setting it now? > > > > > -- > > > > > John Saunders > > > > > Internet Engineer > > > > > jo***********@surfcontrol.com > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
Yeah, I guess if you spend enough time debugging your own cookie errors, you
can sometimes help some else with theirs. :-)
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
"MS News (MS ILM)" <sq**********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Good job John.
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:Ol**************@TK2MSFTNGP12.phx.gbl... Todd, I think someone posted in this thread that there is a problem with cookies and hosts with underscore in the name... -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Todd" <ts****@smithdata.net> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... It is the same for both:
"MyWebProject/Menu.htm"
It works great when I type http://localhost/MyWebProject/Menu.htm into the Browser.
If does not work when I type http://todd_sloan/MyWebProject/Menu.htm into the Browser.
Odd?
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:uO**************@TK2MSFTNGP09.phx.gbl... > Todd, what is window.location.pathname in the case where it works
and the > case where it does not work? > > > -- > John Saunders > Internet Engineer > jo***********@surfcontrol.com > > > > -- > John Saunders > Internet Engineer > jo***********@surfcontrol.com > > > "Todd" <ts****@smithdata.net> wrote in message > news:uI**************@TK2MSFTNGP12.phx.gbl... > > <script language="JavaScript1.2"> > > <!-- > > > > function get_cookie(Name) { > > //Get cookie routine by Shelley Powers > > var search = Name + "=" > > var returnvalue = ""; > > if (document.cookie.length > 0) { > > offset = document.cookie.indexOf(search) > > // if cookie exists > > if (offset != -1) { > > offset += search.length > > // set index of beginning of value > > end = document.cookie.indexOf(";", offset); > > // set index of end of cookie value > > if (end == -1) end = document.cookie.length; > > returnvalue=unescape(document.cookie.substring(off set, end)) > > } > > } > > return returnvalue; > > } > > > > var foldercontentarray=new Array() > > var c=0 > > > > if (ns6){ > > for (i=0;i<document.getElementsByTagName("UL").length; i++){ > > if (document.getElementsByTagName("UL")[i].id=="foldinglist"){ > > foldercontentarray[c]=document.getElementsByTagName("UL")[i] > > c++ > > } > > } > > } > > > > if (get_cookie(window.location.pathname) != ''){ > > var openresults=get_cookie(window.location.pathname).s plit(" ") > > for (i=0 ; i < openresults.length ; i++){ > > if (ns6){ > > foldercontentarray[openresults[i]].style.display='' > > > > >
foldercontentarray[openresults[i]].previousSibling.previousSibling.style.lis > > tStyleImage="url(open.gif)" > > } > > else{ > > foldinglist[openresults[i]].style.display='' > > > > > > > > > > >
document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImag > > e="url(open.gif)" > > } > > } > > } > > > > if (ns6||ie4){ > > var nodelength=ns6? c-1 : foldinglist.length-1 > > var nodes=new Array(nodelength) > > var openones='' > > } > > > > function checkit(){ > > for (i=0 ; i <= nodelength ; i++){ > > if > > >
((ns6&&foldercontentarray[i].style.display=='')||(ie4&&foldinglist[i].style. > > display=='')) > > openones=openones + " " + i > > } > > document.cookie=window.location.pathname+"="+openo nes > > } > > > > if (ns6||ie4) > > window.onunload=checkit > > //--> > > </script> > > > > > > "John Saunders" <jo***********@surfcontrol.com> wrote in message > > news:u%****************@TK2MSFTNGP09.phx.gbl... > > > Todd, > > > > > > I meant the _cookie_ domain. > > > > > > Please post the code you use to create the cookie. > > > > > > -- > > > John Saunders > > > Internet Engineer > > > jo***********@surfcontrol.com > > > > > > > > > "Todd" <ts****@smithdata.net> wrote in message > > > news:%2****************@TK2MSFTNGP12.phx.gbl... > > > > The domain is set to my machine name (todd_sloan). > > > > > > > > How do I change it? > > > > > > > > > > > > "John Saunders" <jo***********@surfcontrol.com> wrote in
message > > > > news:uO**************@TK2MSFTNGP12.phx.gbl... > > > > > "Todd" <ts****@smithdata.net> wrote in message > > > > > news:OQ**************@TK2MSFTNGP10.phx.gbl... > > > > > > Yeah, I will try to hardcode the domain field path for the cookie > > and > > > > see > > > > > if > > > > > > that works. If not I will just scratch everything and keep client > > > state > > > > on > > > > > > an parent IFrame or something..at least I know that works. > > > > > > hehe > > > > > > > > > > Todd, that's not what I said. > > > > > > > > > > I said, try to find out what the domain is set to, then
learn to set > > it > > > > the > > > > > right way. > > > > > > > > > > How are you setting it now? > > > > > -- > > > > > John Saunders > > > > > Internet Engineer > > > > > jo***********@surfcontrol.com > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Pål Johansen |
last post by:
Is it possible to cache portions of a page client side.
I have som include pages that I would like to store at the clients cache.
|
by: Matt |
last post by:
I guess the principal differences between client-side and server-side code
is that
client-side code is processed in web browser, and server-side code is
processed in web server. In ASP.NET web...
|
by: Peter Row |
last post by:
Hi,
I have a web app, there is only really 1 aspx page (that the user never
sees) the rest of the code is done in a DLL that implements HttpHandler.
My app (which is a porting job from Vb6...
|
by: Robin Day |
last post by:
I have a page that contains some dhtml and uses client side cookies so store
it's current state so that on clicking the "back" button to it the page will
be as the user last saw it.
However,...
|
by: rk325 |
last post by:
I have a question about cookies & browser permissions and turning off
cookies when creating a web site (cookieless mode in web.config).
I have a web site that of course uses Session variables....
|
by: dinoo |
last post by:
Hi,
I would appreciate if some one could help me out.
I have to read a client side ini file in Aspx page and use that data in
server side processing. Can any one help me out here?
Please refer...
|
by: Charleees |
last post by:
Hi all,
I have a Login Page whrere all Functionalities such as validations are
Done in Client Side...
I have to Implement Remember My Mail Id and PAss Word Functionality
also in Client side.....
|
by: Sanders Kaufman |
last post by:
When you have a session going, I know that PHP stores a session
token on the client, but does it keep the session *data* on the
client, as well?
Or is the session data being stored on the server,...
|
by: Dan Rumney |
last post by:
Hi all,
I've been writing Javascript for quite a while now and have, of late,
been writing quite a lot of AJAX and AJAX-related code.
In the main, my dynamically generated pages are created...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| | |