View Full Version : Problem with persistent cookie in IE

02-15-2006, 03:28 PM
I have implemented a menu from this site (http://www.dynamicdrive.com/dynamicindex1/switchmenu.htm) on I site I help out at. You can find it here: http://www.holyfile.com

In Firefox everything works perfect but in Internet Explorer the menu collapses when you click on one of the menu items. I have set the script to use persistent cookies and make them sitewide. The javascript code is included in all pages from a .js file as you can see from the source code of the site. When the site is parsed in IE I notice that IE says it contains an error (something about an object not support a method or something like that). What to do since I really want the folder tree to be persistent when clicking links in IE? :)

02-15-2006, 10:01 PM
There are so many other scripts on the page, most likely one or more of them is in conflict. Also (nothing to do with your question), you have not followed the DD terms of use. You need to display the script credit on each page that uses it, not just in the externally linked file and (unrelated to the usage terms) the Language attribute has been deprecated for the type attribute:

<script type="text/javascript" src="menu.js">
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code


<script language="JavaScript" src="menu.js"></script>

02-15-2006, 10:19 PM
I looked into this a bit more and it is not a script conflict that I can see. If you find this function in your menu.js file and add the part in red, it should take care of it:

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
var end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
return returnvalue;

Please also rectify the terms of usage matter mentioned in my previous post in this thread.

02-15-2006, 11:51 PM
Thank you for your reply. First of all I would like to appologize. It was never my intention to remove credits to those due. Just never thought of it that making it a .js file instead of including it in the head would make the notice hidden. It should be changed on both the sites I manage where I have used this menu. :)

Second adding the var solved the problem. Much appreciated. :)

02-15-2007, 10:22 PM
I am experiencing something like the above. I have a website at http://www.itko.dk/home where I use the script. In IE the menu doesn't work (Firefox works like a dream - we love Firefox :). The menu always display the same subId. This is driving me crazy. Please help. It would same my week.