I'm trying to call a standard javascript function document.write off of a string read from a cookie.
The web page sets a cookie like so:
document.cookie="document.write('Charles'); expires=Thu, 18 Dec 2014 12:00:00 UTC; path=/";
It then retrieves the cookie like so:
var x = document.cookie;
After this is done the string contained by x=:
"document.write('Charles')"
So there now is the document.write(str) function in the variable x, however the function does not write "Charles" to the web page.
How can I change this so that when the web page reads the cookie, it automatically outputs "Charles" to the body of the web page through the document.write funcion.
Any help or pointers to the answer would be most appreciated.