PDA

View Full Version : Problem with document.ignore in javascript


farming1234
04-12-2007, 08:54 PM
Hi,
I am using javascript for creating a cookie with the following code
function setcookie(name,value)
{
if(typeof document.cookie == "string")
{
var cookiestring=name+"="+escape(value)+"; EXPIRES=0" ;
document.cookie=cookiestring;
}
else
{
alert("Document is NOT a string");
}
}
The above script is perfectly running in IE6 with cookies as ENABLE as standalone and creating cookie on clients machine, by just creating a simple html file and adding the above code.

But when I add the above code in my application in HTML page which consists of js,css files imported in that html. I am running on localhost and tomcat as server on IE6 version.
By adding the above code, in the application, it is showing me "Document is not a String" alert(going in else loop) while running and document.cookie is replaced document.ignore, when i viewed the code and NOT able to store cookies to client machine.

Pls provide me with suitable solutions to solve the problem of document.ignore in javascript

farming1234
04-12-2007, 11:20 PM
Hi,
I am using javascript for creating a cookie with the following code
function setcookie(name,value)
{
if(typeof document.cookie == "string")
{
var cookiestring=name+"="+escape(value)+"; EXPIRES=0" ;
document.cookie=cookiestring;
}
else
{
alert("Document is NOT a string");
}
}
The above script is perfectly running in IE6 with cookies as ENABLE as standalone and creating cookie on clients machine, by just creating a simple html file and adding the above code.

But when I add the above code in my application in HTML page which consists of js,css files imported in that html. I am running on localhost and tomcat as server on IE6 version.
By adding the above code, in the application, it is showing me "Document is not a String" alert(going in else loop) while running and document.cookie is replaced document.ignore, when i viewed the code and NOT able to store cookies to client machine.
Pls provide me with suitable solutions to solve the problem of document.ignore in javascript


I have also checked this site "http://www.jibbering.com/faq/faq_notes/cookies.html" with the "typeof" but still it is going in else loop....and not accepting (typeof document.cookie=="string")

Alex Vincent
04-13-2007, 05:09 AM
What's document.ignore? I've never heard of that.

_Aerospace_Eng_
04-13-2007, 05:21 AM
This isn't even the right forum for this post.

farming1234
04-13-2007, 08:15 PM
Hi,

Visit this site for more details regarding document.ignore

"http://www.jibbering.com/faq/faq_notes/cookies.html"

glenngv
04-13-2007, 11:21 PM
Hi,

Visit this site for more details regarding document.ignore

"http://www.jibbering.com/faq/faq_notes/cookies.html"
If you follow this link (http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/e128caf75d348100/d41792983ae275fc#d41792983ae275fc) from the link above you provided, you will see that the problem has something to with ZoneAlarm blocking the cookie writing in the client-side. As said in that thread, ZoneAlarm has the capability to change the html source before it's rendered, it replaces document.cookie with document.ignore. The solution offered in the thread was to put the cookie creation code in the server-side so ZoneAlarm won't have any thing to replace. You can still read the cookie in the client-side so you don't have to change that part.