October 4, 200322 yr Newbies I have been trying to use a cookie to pass data from one page to another. So far without success. I can create the cookie, the browser says it's there and enabled, but I can't read it back into the next page. There has been a lot of discussion about using Javascript to do this rather than [FMP-Cookie:data] or [FMP-CurrentCookie]. Can anyone explain what's going on and does anyone have an idea of the JS i could use just to test the theory?
October 4, 200322 yr This is an example of reading a cookie with Javascript: <script> var allcookies = document.cookie ; var pos = allcookies.indexOf("data=") ; if (pos != -1) { var start = pos + 5 ; var end = allcookies.indexOf(";",start) ; if (end == -1) end = allcookies.length ; var value = allcookies.substring(start, end) ; } else { var value = 1 ; } ; </script> </HEAD> Here is a thread with a reasonable discussion on the subject: Passing Cookies All the best. Garry
October 5, 200322 yr Author Newbies Hi Garry Thanks for that, I appreciate it. I still don't understand why the basic [FMP-Cookie] tag doesn't work though! - Musicman
October 5, 200322 yr If people don't allow cookies, you will have problem. If you pass your values or strings via Tokens (up to 10 tokens), there cannot be a problem.
October 10, 200322 yr I will be grappling with this same problem on Tuesday. My concern with tokens is that the user may go to a page in the site that is not part of the shopping section, and I may not have code there to pass the tokens. Wouldn't this drop it, and loose track of the shopping cart? Also, would tokens complicate matters if I show the shopping cart in a separate window, or is everything the same?
October 10, 200322 yr re: My concern with tokens is that the user may go to a page in the site that is not part of the shopping section, and I may not have code there to pass the tokens. Wouldn't this drop it, and loose track of the shopping cart? AFAIK, if you do not stay in contact with FMP you lose the ability to pass the token(s). It is so easy to establish and maintain contact with the db file(s) and provide the code in your format files to pass the tokens that tokens are not an issue in that regard.
October 11, 200322 yr re: My concern with tokens is that the user may go to a page in the site that is not part of the shopping section, and I may not have code there to pass the tokens. Wouldn't this drop it, and loose track of the shopping cart? If you allow the browser window to be reused for another pages, than yes, tokens will lose everything. But you are controlling the show, just don't use your browser window for something outside! You can use URL with Target = "_blank" to spawn new window with outside URL.
October 14, 200322 yr The existing site includes about 170 pages of content, some providing searches of the database, some not. If a guest clicks a link to non-database content, then I loose it, right? Due to consrtaints imposed by my customer, the shopping cart functionality is separate from the rest of the site. It is only available through the dealer price list. Product pages don't have pricing, only part numbers. Seems a daunting task to try to pass the tokens everywhere, especially when the database is not even involved. Wouldn't cookies be better? All I really need is the customer number and the order number.
October 14, 200322 yr Use Cookies. Check the Thread I suggested earlier in this thread. All the best. Garry
October 14, 200322 yr If you will use JS cookies, make sure to test early on site, that JS is enabled. The FM cookies had problems in IE and max expiration value for Fm cookie is 9999. Also cookies are now subject to security settings in browsers and to set cookie in IE6 site should have declared privacy policy.
October 14, 200322 yr I am using Lasso 3.6.6 as middleware, and I guess that is what is doing the setting of the cookies. Any thoughts if this consistantly works? What was the IE problems with cookies? Any work arounds? How would IE6 know if there is a privacy policy? Do I need to insert some code? I really appreciate your excellent information on this, guys! Thanks! Ken
October 15, 200322 yr You didn't say it was Lasso. FM with WebCompanion has problems with cookies; Lasso shouldn't have. On Lasso list are discussions about cookies and different problems with different browsers. IE6 is asking the web server for declared policy in XML file. I would in your case upgrade to Lasso 6 with free upgrade to Lasso 7. Then I will serve all pages through Lasso and use sessions passed in URLs.
Create an account or sign in to comment