January 10, 200323 yr Newbies Hi ppl. This is my first post here, so please, be gentle. I have a cookie implementation on JavaScript working on a web site, so that when a user tries to access a certain page of it with a bookmark, it detects if the cookie exists and if not, then a redirect is performed. However, I've been asked to evolve this solution, so that I could store additional info of the user in the cookie and therefore pass it to a user login database for statistical purposes. This is where the prob begins. Here is a sample code of an html for info detection and cookie storage: <html> <head> <title></title> <script language="javascript"> function detect () { internalCode=navigator.appCodeName; browserName=navigator.appName; browserVer=navigator.appVersion; headerInfo=navigator.userAgent; os=navigator.platform; document.write("Your browser tye is "+internalCode+"<br>"); document.write("You're browsing using "+browserName+"<br>"); document.write("The Web Browser Version is "+browserVer+"<br>"); document.write("Header: "+headerInfo+"<br>"); document.write("OS platform is "+os); } detect (); function setCookie(NameOfCookie,expiredays) { var ExpireDate = new Date (); ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000)); document.cookie = (name=NameOfCookie +"; values =" + escape(navigator.appName+"|"+navigator.appVersion+"|"+navigator.platform) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString())); } setCookie ('cracker',1) // cookie name, days 'till expire = 1 document.write("<br>"+document.cookie) // writes all of the cookie to screen </script> </head> <body> </body> </html> Does anybody know how I can import this info into an DB in FM? I can't get the examples I've got here to work. The mere html fails. I'm near mental meltdown here. Thx in advance J
January 10, 200323 yr Try this: document.cookie = "name=" + NameOfCookie + "; values=" + escape(navigator.appName + "|" + navigator.appVersion + "|" + navigator.platform) + ((expiredays == null) ? "" : ("; expires=" + ExpireDate.toGMTString())); Then on the page you want to use, to add this info to the DB, you would assign the cookie values to <input> tags. You can use either Javascript or CDML ([FMP-Cookie]) to do this. All the best. Garry
Create an account or sign in to comment