Support For Cookies in MQX 3.8?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Support For Cookies in MQX 3.8?

441 Views
Tim562
Senior Contributor I

Hi All,

 

    Does anyone know if there is any support for browser cookies in MQX 3.8? I need some way to secure web pages served by the MQX http server on my device. Once I've prompted a client to enter a username/password (and validated it) I would like to store that info in a cookie that the browser would supply along with it's page requests (no cookie info they get the login page). I make extensive use of MQX's cgi abilities and I wonder if some cgi function call could be executed to read the cookie info (or detect the lack of it)?  Maybe I'm completely off base here and there's some other, better, way to do this? Thanks in advance for any advice or helpfull suggestions.

 

~Tim

Labels (1)
Tags (1)
0 Kudos
1 Reply

262 Views
dspNeil
Contributor III

Hello Tim.

Yes, you can use cookies with MQX. It really has nothing to do with MQX though. I use a Javascript function to store the cookies, and then one to retrive the cookies. On a page load, I call "getCookie()" for each of the variables that I want restored from the web browser's cookie store, and when necessary, I call "setCookie()" to store them off in the browser. Once you've restored the cookies to a Javascript variable, then you could push that value to a hidden form field, or append the values in your html request string to send it to your MQX functions for parsing.

 

I use the exact functions from this page: http://www.w3schools.com/js/js_cookies.asp

 

Good luck,

Neil