ExecuteJavascript and Session.Cookies

I’m setting a cookie with ExecuteJavascript(). Even though I can see the cookie is stored by the browser, I get an empty string when trying to read it with Session.Cookies.

If I refresh the browser, I can then read the cookie with Session.Cookies. Is there any way to read the cookie without having to refresh the browser? Does Session.Cookies not access the cookies stored in the browser directly?

[quote=312596:@Johnny Harris]I’m setting a cookie with ExecuteJavascript(). Even though I can see the cookie is stored by the browser, I get an empty string when trying to read it with Session.Cookies.

If I refresh the browser, I can then read the cookie with Session.Cookies. Is there any way to read the cookie without having to refresh the browser? Does Session.Cookies not access the cookies stored in the browser directly?[/quote]
Remember, everything is asynchronous on the web. So, no. Session.Cookies is only updated from the browser when a session is started.

Is there a reason you’re not setting the cookies using Session.Cookies.Set?

Thanks Greg,

I’m using the WebSDK and the control I’m trying to create a wrapper for returns a Javascript object. I’m converting the object properties to a Json string and trying to read the Json string with Xojo.

Don’t use a cookie for this. In your WebSDK control, use TriggerServerEvent to send a message to the app and send your data as a parameter.

That’s what I’m doing, but wanted to avoid having to shift my code to an event handler.

Using cookies would be far more convoluted if it worked.