Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-20229](5_2_X) Android: WebView and Cookie fix #7784

Merged
merged 1 commit into from Feb 29, 2016

Conversation

ashcoding
Copy link
Contributor

Jira: https://jira.appcelerator.org/browse/TIMOB-20229

Test code:-

var win = Ti.UI.createWindow({
    layout : 'vertical'
});
var url = 'http://www.appcelerator.com/'; //Or any html file
var reload = Ti.UI.createButton({
    title : 'reload',
    height : 50,
    width : 100,
    top : 5,
});

reload.addEventListener('click', function() {
    web.url = url;
});

win.add(reload);

var web = Ti.UI.createWebView({
    url : url,
    width : Ti.UI.FILL,
    top : 100,
    height : Ti.UI.FILL,

});

win.add(web);
var i = 1;

web.addEventListener('load', function(e) {

    var d = new Date();
    d.setTime(d.getTime() + (2 * 24 * 60 * 60 * 1000));

    var cookie = Ti.Network.createCookie({
        name : 'helloWorld',
        domain : url,
        value : "testCookie",
        expiryDate : d,

    });

    Ti.Network.addSystemCookie(cookie, web);
    Ti.API.info("createCookie -> " + JSON.stringify(cookie));

    var cookies = Ti.Network.getSystemCookies(url,null,null);

    if(cookies != null) {
        Ti.API.info("# of cookies -> " + cookies.length);
        for ( i = 0; i <= cookies.length - 1; i++) {
            Ti.API.info("cookie -> " + cookies[i].name + " - " + cookies[i].value);
        }
    }

});

win.open();

@hieupham007
Copy link
Contributor

Code reviewed and functionally tested. Request accepted

hieupham007 added a commit that referenced this pull request Feb 29, 2016
[TIMOB-20229](5_2_X) Android: WebView and Cookie fix
@hieupham007 hieupham007 merged commit fa6abf7 into tidev:5_2_X Feb 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants