Hi,

I need help how to use correctly the javascript : "document.cookie" or
how
to write cookie from javascript in Android web browser ?

I've make sure in the settings that cookie is enabled. When I checked
by
using "navigator.cookieEnabled", it returns true as well.

I've a piece of javascript code as follow that has been working
everywhere
( e.g. PC browsers, iPhone ), but doesn't work in Android.

function createCookie(name) {

        // cookies expired in 1 year.
        var expDate = new Date();
        expDate.setDate(expDate.getDate() + 365);
        expDate = expDate.toGMTString();

        var el = document.getElementById(name);
        document.cookie = name + '=' + escape(el.value) + '; path=/ ;
expires=' + expDate;
        document.cookie = name + '-idx=' + escape(el.selectedIndex) + ';
path=/ ; expires=' + expDate;

        //alert('cookie : ' + document.cookie);
}

When I open the 'alert' comment in the last line of code, Android will
just show blank while
all other browsers show me the content of the cookie that I've just
written.

Please help.

Thanks.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to