Java applet delete browsesr cookies

Posted on 2008-11-05
Last Modified: 2013-11-24

I have java applet in my website. Sometimes I noticed that after my java applet is loaded - the client loses his cookies. it seamed that the Java applet deleting the cookies....

I am using MindTerm Java applet. Their support said that they not delete the browser cookies in their code.

This scenario disconnect the user from my website.
This problem only occur on Internet Explorer 6.

Question by:Cyber-EE
    LVL 12

    Expert Comment

    Hi there;

    so we are sure?

    If you block the use of cookies on the web in general you need to allow it for your website:

    Allow cookies in Internet Explorer:

    1.      Tools [menu]
    2.      Internet Options& [submenu]
    3.      Privacy [tab]
    4.      Sites& [button]
    5.      Type "" and press Allow [button]
    6.      OK until all dialog windows are closed

    Allow JavaScript and Java in Internet Explorer:

    1.      Tools [menu]
    2.      Internet Options& [submenu]
    3.      Security [tab]
    4.      Internet [Web content zone]
    5.      Custom Level& [button]
    6.      Under section called "Scripting"
        a.      "Active scripting" set to Enable
        b.      "Scripting of Java applets" set to Enable
    7.      Ok until all dialog windows are closed

    Best regards...

    Author Comment

    All of the configurations are enabled.

    The problem still occur....
    LVL 3

    Expert Comment

    The following link may help

    if you wanted to do by code then have a look at bellow snippet

           **  delete a cookie, set the expiration in the past
           java.util.Calendar c = java.util.Calendar.getInstance();
           c.add(java.util.Calendar.MONTH, -1);
           String expires = "; expires=" + c.getTime().toString();
           JSObject myBrowser = JSObject.getWindow(this);
           JSObject myDocument =  (JSObject) myBrowser.getMember("document");
           myDocument.setMember("cookie", expires);

    Open in new window


    Author Comment

    How is suppose to help me?

    I don't want to delete the browser cookie.
    I sure that the java applet isn't deleting any cookie.
    LVL 3

    Expert Comment

    oops, sorry for that, how about this one
    In IE 6, from the Tools menu, select Internet options. Click on the Privacy tab. Then click on the Advanced button
    1. Check the Override automatic cookie handling box.
    2. Click on the Accept radio buttons for First-party cookies and Third-party Cookies.
    3. Check the Always allow session cookies box
    4. Click OK twice
    now try with your website and let me know if it works

    Author Comment

    I already do that...

    Still not working....

    Author Comment

    Problem solved!!!!

    My web application is written in

    My cookies defined as HttpOnly Mode.
    cookie.HttpOnly = true;

    This option disable the document.cookie access in client side under internet explorer.
    I removed the HttpOnly limitation from my cookies and suddenly the java applet is working fine.

    I don't know why IE6 is deleting the web application's cookies.

    All the browsers including IE7 support this HttpOnly feature.

    Haapy happy
    Joy Joy

    thanks you all....
    LVL 3

    Expert Comment

    Congratulation Cyber-EE,
                                        Today I add one more tip to my secret knowledge base, thank you for sharing it.
    Happy programming,
    LVL 12

    Expert Comment

    Really happy for you and i appreciate your effort...

    Accepted Solution

    Question PAQ'd, 500 points refunded, and stored in the solution database.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
    I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
    Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now