Newbies Musicman Posted October 4, 2003 Newbies Posted October 4, 2003 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?
Garry Claridge Posted October 4, 2003 Posted October 4, 2003 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
Newbies Musicman Posted October 5, 2003 Author Newbies Posted October 5, 2003 Hi Garry Thanks for that, I appreciate it. I still don't understand why the basic [FMP-Cookie] tag doesn't work though! - Musicman
Anatoli Posted October 5, 2003 Posted October 5, 2003 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.
SoCalMacDude Posted October 10, 2003 Posted October 10, 2003 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?
Unable Posted October 10, 2003 Posted October 10, 2003 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.
Anatoli Posted October 11, 2003 Posted October 11, 2003 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.
SoCalMacDude Posted October 14, 2003 Posted October 14, 2003 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.
Garry Claridge Posted October 14, 2003 Posted October 14, 2003 Use Cookies. Check the Thread I suggested earlier in this thread. All the best. Garry
Anatoli Posted October 14, 2003 Posted October 14, 2003 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.
SoCalMacDude Posted October 14, 2003 Posted October 14, 2003 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
Anatoli Posted October 15, 2003 Posted October 15, 2003 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.
Recommended Posts
This topic is 7702 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now