I have been banging my head against the wall trying to get the http plugin to work for one of our solutions.
I would like to be able to save text entered into a field as a cookie and then later, after closing and reopening the browser, be able to get that data from the cookie to have the field filled in already.
We need this to do a “remember me” checkbox on a login name field on our webclient solution.
Here is some test code I’ve been using.
runs on solution load to start the http client
function onload () {
plugins.http.createHttpClient('DexOnline')
}
onaction event for a button to create the cookie after text entered into test field
function savecookie () {
plugins.http.setHttpClientCookie( 'DexOnline', 'DexOnlineUID', UID, 'ourwebsite.com', '/', 10000000, false)
}
onaction event for a button to put cookie data in the show variable.
function testcookie () {
var cookie = plugins.http.getHttpClientCookie( 'DexOnline', 'DexOnlineUID')
show = cookie.getValue() + ' - ' + cookie.getComment() + ' - ' + cookie.getDomain() + ' - ' + cookie.getName() + ' - ' + cookie.getPath() + ' - ' + cookie.getSecure()
}
This all works great in a single session. Problem is that the cookie expires when the browser is closed. How can we make the cookie expire much later?
Thanks!