Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 02 May 2009, 13:56
Mazinger's Avatar
Mazinger Mazinger is offline
 
Join Date: Nov 2006
Location: Egypt
How to save custom options with cookies

Say, I have implemented a JS code into my forum that allows the user to expand/reduce the forum divider width; it works in the currently page, but when moving to any other page, the browser forgets about the selected options.

I want the browser to remember it and deliver it every time with cookies.

Does any one know how to do that?

Thanks in advance.

--------------- Added 03 May 2009 at 09:31 ---------------

For example, this JS code. It doesn't save choices with cookies with my 3.7.4 forum:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
موقع اخبار مصر واخبار الرياضة والدولار في دليل مصر

Last edited by Mazinger; 03 May 2009 at 09:31. Reason: Auto-Merged DoublePost
Reply With Quote
  #2  
Old 04 May 2009, 15:13
Mazinger's Avatar
Mazinger Mazinger is offline
 
Join Date: Nov 2006
Location: Egypt
Any body here experienced with JS and knows how vBulletin handle cookies?

Please, it's urgent.
__________________
موقع اخبار مصر واخبار الرياضة والدولار في دليل مصر
Reply With Quote
  #3  
Old 04 May 2009, 16:21
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Have you looked at the API? vBulletin API
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #4  
Old 04 May 2009, 17:18
Mazinger's Avatar
Mazinger Mazinger is offline
 
Join Date: Nov 2006
Location: Egypt
I'm sure I'll sink if I looked at this again.

It seems that the JS code I posted does already have a cookie script into it, it doesn't work for a reason though.
__________________
موقع اخبار مصر واخبار الرياضة والدولار في دليل مصر
Reply With Quote
  #5  
Old 13 May 2009, 00:26
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Real name: Lea Verou
Is the problem that the cookie is not saved correctly or that it's not read correctly? Check your cookies to find out. It would help us go through less code if we know the exact problem.
By the way, most of these functions are already present in vBulletin's JS code or the YUI modules it uses. I'd suggest you take a look, duplicating functionality is not good, since your users download more stuff = higher waiting time for the page to load.
Reply With Quote
  #6  
Old 13 May 2009, 00:36
RLShare RLShare is offline
 
Join Date: Jun 2008
If you are attatching your function to the window.onload event in your head or a file included in the head then it is more then likely getting replaced by the opening body tag of the page in VB.
__________________

Last edited by RLShare; 13 May 2009 at 00:42.
Reply With Quote
  #7  
Old 14 May 2009, 10:27
Mazinger's Avatar
Mazinger Mazinger is offline
 
Join Date: Nov 2006
Location: Egypt
Thanks everybody, I've already handled this issue with an alternate JS code I got from somewhere.

I appreciate your help though.
__________________
موقع اخبار مصر واخبار الرياضة والدولار في دليل مصر
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 09:13.

Layout Options | Width: Wide Color: