Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Community > MacNN Lounge > Web expert help needed: Safari 2 (Tiger) MooTools/JavaScript bug is driving me nuts!

Web expert help needed: Safari 2 (Tiger) MooTools/JavaScript bug is driving me nuts!
Thread Tools
t_hah
Mac Elite
Join Date: Dec 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Jan 28, 2008, 05:50 PM
 
Can someone with Tiger and some JavaScript knowledge help me out please?

The following page works fine in FF and in Safari 3. For some reason under Safari 2 the JavaScript console gives the following error:
"Null value Line: 1"

Our forum page

A quick rundown what the code does. The orange and green fields have some text content. These are placed into two div pairs. The orange box has two (box11 and box12) and the green box has two as well (box21 and box22).

By default, when the page is loaded I am setting two Cookies to 1. Their names are: display_forum and display_tarsalgo. For some reason these vales are not being set in Safari. I think that is because the JavaScript is not being loaded.

Any help and/or pointers would be appreciated!
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Jan 28, 2008, 06:23 PM
 
At what point are these cookie values set? What are these cookies designed to handle? I've found that some browsers create a race issue where in order for a cookie to be recognized a slight delay is necessary. Is there anyway that your software could count on data being set by a variable rather than a cookie? What happens if you set a session variable? Is it recognized in Safari upon page reload?
     
t_hah  (op)
Mac Elite
Join Date: Dec 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Jan 28, 2008, 06:37 PM
 
Originally Posted by besson3c View Post
At what point are these cookie values set? What are these cookies designed to handle? I've found that some browsers create a race issue where in order for a cookie to be recognized a slight delay is necessary. Is there anyway that your software could count on data being set by a variable rather than a cookie? What happens if you set a session variable? Is it recognized in Safari upon page reload?
I am checking if the Cookie exists, if it does not, I am setting a default value. These cookies handle whether the browser should display box11 or box12. The other cookie sets the visibility for box21 or box22.

Basically the orange and the green box both have a link on the bottom that says: "témák / válaszok"

By clicking on this link you are switching the cookie value, and also switching the visibility of box11/box12 and box21/box22.

For some reason Safari 2 does not even get to this point. As I mentioned, in the JavaScript console it only says "Null value LIne:1"

... and the cookie never gets set. So I am thinking it has an issue with the Javascript code... but not sure what.
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Jan 28, 2008, 06:43 PM
 
When you refer to cookies do you really mean session variables? If not, why not also set session vars and check on those too?

Like I said, cookies are very particular when it comes to timing. It is very difficult to get setting a cookie on page load and for it to be simultaneously understood on that same page load when it is referenced by the predefined variable name for cookies (e.g. in PHP this is $_COOKIE). In order words, it takes a little time for that cookie to be set to be recognized. If you are simply resetting a cookie, would referencing the old cookie value as a fallback work?

You might need to come up with a better scheme that is less dependent on seeing the cookie value immediately. I've run up against this problem before myself, and I'd be willing to bet that what you are trying to do doesn't work in IE either.
     
t_hah  (op)
Mac Elite
Join Date: Dec 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Jan 28, 2008, 06:48 PM
 
The base of this solution is MooTools which is a JS library. It has some functions to allow exactly what you are mentioning to happen.
     
reader50
Administrator
Join Date: Jun 2000
Location: California
Status: Offline
Reply With Quote
Jan 28, 2008, 10:28 PM
 
We do have a Developer Forum for these kinds of problems.
     
t_hah  (op)
Mac Elite
Join Date: Dec 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Jan 29, 2008, 01:30 AM
 
Sorry, you are right. Could you please move the thread?
     
t_hah  (op)
Mac Elite
Join Date: Dec 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Jan 29, 2008, 05:01 AM
 
I figured out the issue. The problem was caused by the Mootools JS library. They have some kind of an issue or maybe a bug in their code. I downloaded a newer version of it and it is working now.

Thank you for the help and for the ideas.
     
   
 
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -4. The time now is 11:58 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,