View Full Version : Session cookie (long)
januszk
Nov-02-2005, 02:42 PM
Hi all
I need some help with the way smugmug.com is organized. On my smugmug page (http://januszk.smugmug.com (http://januszk.smugmug.com/)) I've implemented a splash screen. The splash screen should be displayed if:
-user opens http://januszk.smugmug.com (http://januszk.smugmug.com/)
-this is first visit in current browser session at http://januszk.smugmug.com/ (http://januszk.smugmug.com/) and any sub pages
To make sure that splash screen is displayed only once I'm using session cookie that I set at the beginning. I also have a navigation bar with button "Galleries" that should go to my home page. Everything works fine if I start browsing from my home page. Splash screen is displayed, cookie is set and everything looks fine. If I start browsing from any Category it also works (what I mean is that I type http://januszk.smugmug.com/Nature (http://januszk.smugmug.com/Nature) instead of http://januszk.smugmug.com (http://januszk.smugmug.com/) ). Since this is not a home page splash screen is not displayed. If then I press "Galleries" button it takes me to the home page and splash screen is not displayed (which is OK, since this is not first page visited in domain januszk.smugmug.com). The problem starts when I start browsing with any subcategory, gallery or picture. When I type in my browser http://januszk.smugmug.com/Travel/116698 (http://januszk.smugmug.com/Travel/116698) splash screen is not displayed since this is not a homepage and cookie is set to indicate that I've started browsing. If I then click the "Galleries" button splash screen is displayed. When I debug it I found out that after pressing "Galleries" button cookie that was set a few seconds ago in the same session is gone and browser "thinks" that it is first visit.
Since the description is a little confusing, if you’d like to help me out those are the steps:
1. Open http://januszk.smugmug.com (http://januszk.smugmug.com/) – splash is displayed. Click Galleries button, galleries are displayed, everything works fine. Close browser
2. Open http://januszk.smugmug.com/Travel/ (http://januszk.smugmug.com/Travel/) - splash is not displayed, since this is not a homepage. Click Galleries button, splash is not displayed since this is not first page visited. Close browser
3. Open http://januszk.smugmug.com/Travel/116698 (http://januszk.smugmug.com/Travel/116698) - splash is not displayed since this is not a homepage. Click Galleries button and here come my proble: splash is displayed even though it shouldn’t be. The same happens if first page is any gallery or picture.
The same code should be executed regardless if the first page is category or gallery
Does anyone have any idea why this is happening and how to fix it? I can describe exactly how this cookie-splash configuration works, but this post is already too long.
Thank you,
Janusz
Andy
Nov-02-2005, 03:03 PM
janusz, you may want to edit your post please, to use black text only - lots of folks use the dgrin "white" style and if you try that, you'll get a surprise :D
Mike Lane
Nov-02-2005, 03:13 PM
I am really interested to see something like this work januszk. I can't help you unfortunately, but I am interested to see it in action! Once you've worked out all the bugs would you care to post a tutorial about how you did it? :D
januszk
Nov-02-2005, 03:15 PM
janusz, you may want to edit your post please, to use black text only - lots of folks use the dgrin "white" style and if you try that, you'll get a surprise :DSorry about that. I hope now its OK. I can't really go much darker on my default background.
Janusz
jfriend
Nov-02-2005, 03:26 PM
Hi all
I need some help with the way smugmug.com is organized. On my smugmug page (http://januszk.smugmug.com (http://januszk.smugmug.com/)) I've implemented a splash screen. The splash screen should be displayed if:
-user opens http://januszk.smugmug.com (http://januszk.smugmug.com/)
-this is first visit in current browser session at http://januszk.smugmug.com/ (http://januszk.smugmug.com/) and any sub pages
To make sure that splash screen is displayed only once I'm using session cookie that I set at the beginning. I also have a navigation bar with button "Galleries" that should go to my home page. Everything works fine if I start browsing from my home page. Splash screen is displayed, cookie is set and everything looks fine. If I start browsing from any Category it also works (what I mean is that I type http://januszk.smugmug.com/Nature (http://januszk.smugmug.com/Nature) instead of http://januszk.smugmug.com (http://januszk.smugmug.com/) ). Since this is not a home page splash screen is not displayed. If then I press "Galleries" button it takes me to the home page and splash screen is not displayed (which is OK, since this is not first page visited in domain januszk.smugmug.com). The problem starts when I start browsing with any subcategory, gallery or picture. When I type in my browser http://januszk.smugmug.com/Travel/116698 (http://januszk.smugmug.com/Travel/116698) splash screen is not displayed since this is not a homepage and cookie is set to indicate that I've started browsing. If I then click the "Galleries" button splash screen is displayed. When I debug it I found out that after pressing "Galleries" button cookie that was set a few seconds ago in the same session is gone and browser "thinks" that it is first visit.
Since the description is a little confusing, if you’d like to help me out those are the steps:
1. Open http://januszk.smugmug.com (http://januszk.smugmug.com/) – splash is displayed. Click Galleries button, galleries are displayed, everything works fine. Close browser
2. Open http://januszk.smugmug.com/Travel/ (http://januszk.smugmug.com/Travel/) - splash is not displayed, since this is not a homepage. Click Galleries button, splash is not displayed since this is not first page visited. Close browser
3. Open http://januszk.smugmug.com/Travel/116698 (http://januszk.smugmug.com/Travel/116698) - splash is not displayed since this is not a homepage. Click Galleries button and here come my proble: splash is displayed even though it shouldn’t be. The same happens if first page is any gallery or picture.
The same code should be executed regardless if the first page is category or gallery
Does anyone have any idea why this is happening and how to fix it? I can describe exactly how this cookie-splash configuration works, but this post is already too long.
Thank you,
Janusz
I'll take a look at your JavaScript tonight. Won't get to it for a few hours, but we should be able to figure it out.
januszk
Nov-02-2005, 03:39 PM
I am really interested to see something like this work januszk. I can't help you unfortunately, but I am interested to see it in action! Once you've worked out all the bugs would you care to post a tutorial about how you did it? :DIf it works I'll try to. I'm usually the one who reads the tutorials, not the one who posts them so it will be kind of challenge :-)
jfriend
Nov-02-2005, 04:51 PM
Hi all
I need some help with the way smugmug.com is organized. On my smugmug page (http://januszk.smugmug.com (http://januszk.smugmug.com/)) I've implemented a splash screen. The splash screen should be displayed if:
-user opens http://januszk.smugmug.com (http://januszk.smugmug.com/)
-this is first visit in current browser session at http://januszk.smugmug.com/ (http://januszk.smugmug.com/) and any sub pages
To make sure that splash screen is displayed only once I'm using session cookie that I set at the beginning. I also have a navigation bar with button "Galleries" that should go to my home page. Everything works fine if I start browsing from my home page. Splash screen is displayed, cookie is set and everything looks fine. If I start browsing from any Category it also works (what I mean is that I type http://januszk.smugmug.com/Nature (http://januszk.smugmug.com/Nature) instead of http://januszk.smugmug.com (http://januszk.smugmug.com/) ). Since this is not a home page splash screen is not displayed. If then I press "Galleries" button it takes me to the home page and splash screen is not displayed (which is OK, since this is not first page visited in domain januszk.smugmug.com). The problem starts when I start browsing with any subcategory, gallery or picture. When I type in my browser http://januszk.smugmug.com/Travel/116698 (http://januszk.smugmug.com/Travel/116698) splash screen is not displayed since this is not a homepage and cookie is set to indicate that I've started browsing. If I then click the "Galleries" button splash screen is displayed. When I debug it I found out that after pressing "Galleries" button cookie that was set a few seconds ago in the same session is gone and browser "thinks" that it is first visit.
Since the description is a little confusing, if you’d like to help me out those are the steps:
1. Open http://januszk.smugmug.com (http://januszk.smugmug.com/) – splash is displayed. Click Galleries button, galleries are displayed, everything works fine. Close browser
2. Open http://januszk.smugmug.com/Travel/ (http://januszk.smugmug.com/Travel/) - splash is not displayed, since this is not a homepage. Click Galleries button, splash is not displayed since this is not first page visited. Close browser
3. Open http://januszk.smugmug.com/Travel/116698 (http://januszk.smugmug.com/Travel/116698) - splash is not displayed since this is not a homepage. Click Galleries button and here come my proble: splash is displayed even though it shouldn’t be. The same happens if first page is any gallery or picture.
The same code should be executed regardless if the first page is category or gallery
Does anyone have any idea why this is happening and how to fix it? I can describe exactly how this cookie-splash configuration works, but this post is already too long.
Thank you,
Janusz
Here are several observations.
1) Did you consider using the readCookie function that's already in the page from smugmug (you'll find it at the bottom of the page)? It's a bit more general purpose and a little more foolproof than the code you've written.
2) I suspect that the problem you are seeing is that you aren't setting a path. And, if I understand the JavaScript doc correctly, if you don't set the path, it defaults to the path of the current document, so you will only get the cookie when you are on that exact path. That would explain why when you set the cookie on a category and then go to the home page, you don't see the cookie you think you just set. Because the path doesn't match, the cookie isn't being offered to you. To make it so all your pages can see the same cookie, you need to append "; path=/" as part of your cookie.
3) Rather than just set window.location = newURL when you show your splash screen, you probably want to use window.location.replace(newURL). This will replace the original location in the history with the new location and make it so the back button works appropriately if the user hits it.
4) I didn't go through the details of your getCookie function to check it out and see if there were any errors in there. I'd suggest you either use the readCookie function that's already in there from smugmug or just copy it's code into your function since it's fully tested already and simpler.
5) When you are trying to remove a previously set cookie, you also need to match the path value. If the path is not set, it defaults to the path of the current document so if you try to delete a cookie with a different path, it won't succeed in deleting the one you want.
Let me know if this helps get it working. If not, I'll examine it closer.
januszk
Nov-02-2005, 06:16 PM
Here are several observations.
1) Did you consider using the readCookie function that's already in the page from smugmug (you'll find it at the bottom of the page)? It's a bit more general purpose and a little more foolproof than the code you've written.
2) I suspect that the problem you are seeing is that you aren't setting a path. And, if I understand the JavaScript doc correctly, if you don't set the path, it defaults to the path of the current document, so you will only get the cookie when you are on that exact path. That would explain why when you set the cookie on a category and then go to the home page, you don't see the cookie you think you just set. Because the path doesn't match, the cookie isn't being offered to you. To make it so all your pages can see the same cookie, you need to append "; path=/" as part of your cookie.
3) Rather than just set window.location = newURL when you show your splash screen, you probably want to use window.location.replace(newURL). This will replace the original location in the history with the new location and make it so the back button works appropriately if the user hits it.
4) I didn't go through the details of your getCookie function to check it out and see if there were any errors in there. I'd suggest you either use the readCookie function that's already in there from smugmug or just copy it's code into your function since it's fully tested already and simpler.
5) When you are trying to remove a previously set cookie, you also need to match the path value. If the path is not set, it defaults to the path of the current document so if you try to delete a cookie with a different path, it won't succeed in deleting the one you want.
Let me know if this helps get it working. If not, I'll examine it closer.Thanks jfriend. I'll definitely try your suggestions. Actually I've just noticed a couple of days ago that there is readCookie function. I was going to try it out. The getCookie is not mine. I found it on one of the tutorials. I wanted to give the author credit for it but I couldn't find where I took it from. I didn't know about the cookie path. I'll check it more carefully. Do you think that path is important for session cookie ? They are being created in the memory, not at the drive. I don't really care about the back button. Actually I'd prefer it not to work. The idea of splash screen is to display it only once at the beginning and never go back to it during current session. I'm not removing cookie manually. Since it is session cookie it is removed automatically when current browser is closed. Since I don't need to remember anything after browser is closed thats perfect for me. If your theory is right than why do you think it works fine if first opened page is a Category and it doesn't when first opened page is Subcategory or Gallery ? See my original post. When first address is homepage (item 1) or category (item 2) it works fine. The problem starts if the first address is something below category (item 3).
Janusz
jfriend
Nov-02-2005, 06:58 PM
Thanks jfriend. I'll definitely try your suggestions. Actually I've just noticed a couple of days ago that there is readCookie function. I was going to try it out. The getCookie is not mine. I found it on one of the tutorials. I wanted to give the author credit for it but I couldn't find where I took it from. I didn't know about the cookie path. I'll check it more carefully. Do you think that path is important for session cookie ? They are being created in the memory, not at the drive. I don't really care about the back button. Actually I'd prefer it not to work. The idea of splash screen is to display it only once at the beginning and never go back to it during current session. I'm not removing cookie manually. Since it is session cookie it is removed automatically when current browser is closed. Since I don't need to remember anything after browser is closed thats perfect for me. If your theory is right than why do you think it works fine if first opened page is a Category and it doesn't when first opened page is Subcategory or Gallery ? See my original post. When first address is homepage (item 1) or category (item 2) it works fine. The problem starts if the first address is something below category (item 3).
Janusz The cookie path matters whether it's a session cookie or a persistent cookie. It's an important piece of cookie functionality that lets different parts of a site have separate cookies that aren't visible to other parts of the site.
If you don't specify a path, then the path defaults to the directory of your current page. That means that only documents in that directory will be able to see that cookie. In your case, that means if you go directly to a gallery which on smugmug has a URL like "http://jfriend.smugmug.com/gallery/879690", any cookies you set from that page will only be accessible from within that directory. They will not be accessible from your home page, thus you would display your splash screen because you would think the cookie was not set even though you didn't intend to.
Whether it works on a category which on smugmug looks like "http://jfriend.smugmug.com/Portfolio" depends upon how the browser interprets the path. If it says that the path of the category is "http://jfriend.smugmug.com/", then you would end up with a cookie that you could also see from your home page. Since that's what you are experiencing, that's probably how it works. But, with a gallery with an URL like "http://jfriend.smugmug.com/gallery/879690", the path will probably be "http://jfriend.smugmug.com/gallery" and thus the cookie will not be visible to your home page.
You may not be removing it manually, but you are trying to set it to a state of 0. My point was that all changes to the cookie should have the same path if you intend to be changing the same cookie. If the path differs, you won't suceed in modifying the cookie you intended.
I'd suggest using the built-in readCookie. It's a lot simpler than the one you found.
Here's some verbatim Javascript documentation from mozilla.org for setting a cookie (full page here (http://devedge-temp.mozilla.org/library/manuals/2000/javascript/1.3/reference/cookies.html)):
" PATH=pathName specifies the path attributes for a valid cookie. See "Determining a Valid Cookie" on page 677 (http://devedge-temp.mozilla.org/library/manuals/2000/javascript/1.3/reference/cookies.html#1003254). If you do not specify a value for pathName, Navigator uses the path of the document that created the cookie property (or the path of the document described by the HTTP header, for CGI programming)."
And here's some of the doc for reading the cookie (e.g. which cookies will be returned) from here (http://devedge-temp.mozilla.org/library/manuals/2000/javascript/1.3/reference/cookies.html#1003254):
"PATH=pathName specifies the URLs in a domain for which the cookie is valid. If a cookie has already passed domain matching, then the pathname component of the URL is compared with the path attribute, and if there is a match, the cookie is considered valid and is sent along with the URL request. For example, PATH=/foo matches /foobar and /foo/bar.html. The path "/" is the most general path."
To summarize. If you don't set the path, it defaults to the directory of the current page. This means that a cookie you set will only be visible to pages in that directory or below. Whereas, if you set the path to "/", all pages on your site will see the cookie.
jfriend
Nov-02-2005, 07:55 PM
The cookie path matters whether it's a session cookie or a persistent cookie. It's an important piece of cookie functionality that lets different parts of a site have separate cookies that aren't visible to other parts of the site. OK, one more thing. In looking at the ShowSpash function, I'm not sure how it could ever work.
//show splash gallery
function showSplash()
{
if(getCookie('SplashDisplayed')=='')
{
document.cookie="SplashDisplayed=0";
if(getCookie('SplashDisplayed')=='0' && window.location=="http://januszk.smugmug.com/")
{ window.location="http://januszk.smugmug.com/gallery/922871";
document.cookie="SplashDisplayed=1";
}
}
}
First, you test to see if there's any value for SplashDisplayed.
Problem #1: If there is no value for SplashDisplayed (e.g. cookie has never been set), you don't display the splash screen.
Then, you set the value of SplashDisplayed in the cookie to zero. Then you get the value of SplashDisplayed and test to see if it is 0. It will always be zero at that point because you just set it to zero. So, you will never detect that you've already displayed the splash screen.
Problem #2: It looks to me like the only time this code will ever display the spash screen is when the cookie is set (to any value) and you are on your home page.
Here's what I would suggest you use if you stay with your cookie function. Let me know if you have questions:
function showSplash()
{
// if we haven't already displayed the splash screen in this session and we're on the home page
if (getCookie('SplashDisplayed') != '1') && (window.location == "http://januszk.smugmug.com/"))
{
// set a cookie that we've done the splash screen (do this before we change the location)
document.cookie="SplashDisplayed=1; path=/";
// go to the splash screen
window.location = "http://januszk.smugmug.com/gallery/922871";
}
}
januszk
Nov-02-2005, 07:55 PM
The cookie path matters whether it's a session cookie or a persistent cookie. It's an important piece of cookie functionality that lets different parts of a site have separate cookies that aren't visible to other parts of the site.
If you don't specify a path, then the path defaults to the directory of your current page. That means that only documents in that directory will be able to see that cookie. In your case, that means if you go directly to a gallery which on smugmug has a URL like "http://jfriend.smugmug.com/gallery/879690", any cookies you set from that page will only be accessible from within that directory. They will not be accessible from your home page, thus you would display your splash screen because you would think the cookie was not set even though you didn't intend to.
Whether it works on a category which on smugmug looks like "http://jfriend.smugmug.com/Portfolio" depends upon how the browser interprets the path. If it says that the path of the category is "http://jfriend.smugmug.com/", then you would end up with a cookie that you could also see from your home page. Since that's what you are experiencing, that's probably how it works. But, with a gallery with an URL like "http://jfriend.smugmug.com/gallery/879690", the path will probably be "http://jfriend.smugmug.com/gallery" and thus the cookie will not be visible to your home page.
You may not be removing it manually, but you are trying to set it to a state of 0. My point was that all changes to the cookie should have the same path if you intend to be changing the same cookie. If the path differs, you won't suceed in modifying the cookie you intended.
I'd suggest using the built-in readCookie. It's a lot simpler than the one you found.
Here's some verbatim Javascript documentation from mozilla.org for setting a cookie (full page here (http://devedge-temp.mozilla.org/library/manuals/2000/javascript/1.3/reference/cookies.html)):
" PATH=pathName specifies the path attributes for a valid cookie. See "Determining a Valid Cookie" on page 677 (http://devedge-temp.mozilla.org/library/manuals/2000/javascript/1.3/reference/cookies.html#1003254). If you do not specify a value for pathName, Navigator uses the path of the document that created the cookie property (or the path of the document described by the HTTP header, for CGI programming)."
And here's some of the doc for reading the cookie (e.g. which cookies will be returned) from here (http://devedge-temp.mozilla.org/library/manuals/2000/javascript/1.3/reference/cookies.html#1003254):
"PATH=pathName specifies the URLs in a domain for which the cookie is valid. If a cookie has already passed domain matching, then the pathname component of the URL is compared with the path attribute, and if there is a match, the cookie is considered valid and is sent along with the URL request. For example, PATH=/foo matches /foobar and /foo/bar.html. The path "/" is the most general path."
To summarize. If you don't set the path, it defaults to the directory of the current page. This means that a cookie you set will only be visible to pages in that directory or below. Whereas, if you set the path to "/", all pages on your site will see the cookie.Using ;path=/ worked like a dream. Thanks a lot jfriend. I don't think I'd figure it out myself :-)
Janusz
januszk
Nov-02-2005, 08:16 PM
OK, one more thing. In looking at the ShowSpash function, I'm not sure how it could ever work.
//show splash gallery
function showSplash()
{
if(getCookie('SplashDisplayed')=='')
{
document.cookie="SplashDisplayed=0";
if(getCookie('SplashDisplayed')=='0' && window.location=="http://januszk.smugmug.com/")
{ window.location="http://januszk.smugmug.com/gallery/922871";
document.cookie="SplashDisplayed=1";
}
}
}
First, you test to see if there's any value for SplashDisplayed.
Problem #1: If there is no value for SplashDisplayed (e.g. cookie has never been set), you don't display the splash screen.
Then, you set the value of SplashDisplayed in the cookie to zero. Then you get the value of SplashDisplayed and test to see if it is 0. It will always be zero at that point because you just set it to zero. So, you will never detect that you've already displayed the splash screen.
Problem #2: It looks to me like the only time this code will ever display the spash screen is when the cookie is set (to any value) and you are on your home page.
Here's what I would suggest you use if you stay with your cookie function. Let me know if you have questions:
function showSplash()
{
// if we haven't already displayed the splash screen in this session and we're on the home page
if (getCookie('SplashDisplayed') != '1') && (window.location == "http://januszk.smugmug.com/"))
{
// set a cookie that we've done the splash screen (do this before we change the location)
document.cookie="SplashDisplayed=1; path=/";
// go to the splash screen
window.location = "http://januszk.smugmug.com/gallery/922871";
}
}
Actually, that's not really how it works. First I check if value of the cookie is null. It will be null only if this is the first time user visits my page. If it is not null that means you've already been there so forget the splash. Then I set cookie to 0. This is the safety valve. If you set your browser not to accept cookies than I don't want to display splash screen since I won't be able to determine if you've already seen it or not. So, if your browser is secure and you don't accept cookies then I don't show you my splash screen but take you directly to my galleries. If however the cookie was set to 0 and the current page is my home page than I do redirection to my splash page which actually is a gallery. I also set then cookie to value 1 but it doesn't matter (I wanted to use it further to determine if splash was displayed or not). As you can see the splash will display (the redirection will work) if you are visiting my homepage and if this is first visit in januszk.smugmug.com domain. Now, if first page is something else, like http://januszk.smugmug.com/Travel then first validation passes, since cookie is not set, then cookie is set to 0 but second validation fails since this is not my homepage. Splash is not displayed. That's exactly how I wanted it to work. If you know the exact name and location of my gallery or picture you want to see it, not my splash. Thats pretty much it.
Janusz
jfriend
Nov-02-2005, 08:27 PM
Actually, that's not really how it works. First I check if value of the cookie is null. It will be null only if this is the first time user visits my page. If it is not null that means you've already been there so forget the splash. Then I set cookie to 0. This is the safety valve. If you set your browser not to accept cookies than I don't want to display splash screen since I won't be able to determine if you've already seen it or not. So, if your browser is secure and you don't accept cookies then I don't show you my splash screen but take you directly to my galleries. If however the cookie was set to 0 and the current page is my home page than I do redirection to my splash page which actually is a gallery. I also set then cookie to value 1 but it doesn't matter (I wanted to use it further to determine if splash was displayed or not). As you can see the splash will display (the redirection will work) if you are visiting my homepage and if this is first visit in januszk.smugmug.com domain. Now, if first page is something else, like http://januszk.smugmug.com/Travel then first validation passes, since cookie is not set, then cookie is set to 0 but second validation fails since this is not my homepage. Splash is not displayed. That's exactly how I wanted it to work. If you know the exact name and location of my gallery or picture you want to see it, not my splash. Thats pretty much it.
Janusz
Hmm. OK, you're doing something different than I was trying to do. You are trying to display the splash screen only when there's no cookie set and only when setting a cookie works (e.g. cookies are enabled). If cookies are disabled, you will never display the splash screen. Your code will do that fine - sorry for trying to change it's function. Is there any reason to have the line:
document.cookie="SplashDisplayed=1";
in your code. It doesn't appear to add any value. Your current code doesn't care whether the cookie is set to 0 or 1. If it's set at all (whether 0 or 1), it will not display the splash screen and you've already set it to 0.
januszk
Nov-02-2005, 08:40 PM
Hmm. OK, you're doing something different than I was trying to do. You are trying to display the splash screen only when there's no cookie set and only when setting a cookie works (e.g. cookies are enabled). If cookies are disabled, you will never display the splash screen. Your code will do that fine - sorry for trying to change it's function. Is there any reason to have the line:
document.cookie="SplashDisplayed=1";
in your code. It doesn't appear to add any value. Your current code doesn't care whether the cookie is set to 0 or 1. If it's set at all (whether 0 or 1), it will not display the splash screen and you've already set it to 0.
You are right, it doesn't. In the first version of the idea I wanted to do a splash screen that would be a picture displayed over the list of categories. To do this I needed to change, back and forth, the "displayed" property of several objects and I had to use 3 stages: not set, set but not yet displayed, set and displayed. Since I decided to go with redirection it doesn't have any use anymore. It doesn't do any harm either.
BTW: In order to use readCookie function from smugmug I copied their code into my javascript box. Do you know if I can include it somehow without copying ?
jfriend
Nov-02-2005, 09:04 PM
You are right, it doesn't. In the first version of the idea I wanted to do a splash screen that would be a picture displayed over the list of categories. To do this I needed to change, back and forth, the "displayed" property of several objects and I had to use 3 stages: not set, set but not yet displayed, set and displayed. Since I decided to go with redirection it doesn't have any use anymore. It doesn't do any harm either.
BTW: In order to use readCookie function from smugmug I copied their code into my javascript box. Do you know if I can include it somehow without copying ? Their code is already in the page. You don't have to copy it into your box at all to use it - you can just call their function name. If you do copy it into your box, you should change the name of the function so it's different than theirs and won't conflict.
Because their function is declared at the end of the page and thus isn't yet defined when you call your current splash screen function, it might complicate matters to call theirs directly because you'd probably have to do it from an onLoad function handler after the page was fully loaded. It might be easier to just go with a copy with your own function name. It's only a few lines of code so it's not a big waste to have a 2nd copy and it will look better if you execute your code when it does now rather than waiting for an onLoad handler.
It sounds like your done!
januszk
Nov-02-2005, 09:14 PM
Their code is already in the page. You don't have to copy it into your box at all to use it - you can just call their function name. If you do copy it into your box, you should change the name of the function so it's different than theirs and won't conflict.
Because their function is declared at the end of the page and thus isn't yet defined when you call your current splash screen function, it might complicate matters to call theirs directly because you'd probably have to do it from an onLoad function handler after the page was fully loaded. It might be easier to just go with a copy with your own function name. It's only a few lines of code so it's not a big waste to have a 2nd copy and it will look better if you execute your code when it does now rather than waiting for an onLoad handler.
It sounds like your done!That's exactly right. At first I wante to do it in onLoad but id didn't look good. I've tried to call their function but, as you said, it's declared at the bottom so I can't see it. I'll stay with the copy. Thanks a lot for everything.
Janusz
Mike Lane
Nov-02-2005, 09:15 PM
Hey great color scheme and navbar! :thumb
januszk
Nov-03-2005, 03:18 AM
Hey great color scheme and navbar! :thumbThanks. The navigation bar is mostly your design :-) I've learn from your sites like pristine-light and choicephoto.
Janusz
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.