View Full Version : Sticky Note - Close if click the hide button twice from the website

07-03-2017, 12:41 PM
1) Script Title: Sticky Note script v2.0

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/stickynote.htm

3) Describe problem:

Hi! I love the code but I would like to have a functionality in this script of after clicking twice the hide button the sticky note will not appear again in other pages of the website. Any idea please.. thanks in advance.



07-03-2017, 02:01 PM
Try this modified version of the script (allows note to be shown twice per session):


Use 'session' for the showfrequency property.

The browser cache may have to cleared, the page refreshed, and/or any existing cookie cleared to see changes.

NOTES: This modification uses the browser cookie already generated by the script. It will not work if cookies are turned off. Also, if testing locally, cookies might not work at all, so be sure to try it on a live page. Any existing cookie from previous tests may interfere with the new code. So, if you've already used the cookie in testing the script, either close the browser session or clear the cookie before testing the new code.

07-04-2017, 05:39 AM
Thanks John. This is great!

However, what I am looking for is not a browser session. I am looking into the number of clicks it is closed for example I am in the home page and the sticky note appears then hit close (1st click) then after that I go to about us page the sticky note appears then hit closed (2nd click). Then I open again another page for example contact us page or any other page of the website the sticky note will not going to appear anymore. Any idea?

07-04-2017, 02:50 PM
This does that as far as I can tell. Since it can only appear twice per session, by the second click to close it, it will not appear again. The session is a site wide cookie. Most browsers these days save sessions even when they are closed, so this is pretty permanent. We could make it a permanent cookie though. That would mean that the note would never be seen again unless the user clears the cookie or logs in with a different browser.

07-05-2017, 05:18 AM
Okay! anyhow the modified version of the script is great. :D

07-05-2017, 02:26 PM
Sorry, didn't mean to end the discussion. I just don't see any difference between what you asked for and what the modified code does. If there is some problem I'd be happy to see if a different or additional modification could be made to address that. But, if so, you will have to make it clearer to me what you're after and how that would differ from the behavior of the current modified script.

07-06-2017, 08:01 AM
Sorry for not being clear. So far the modified version of the script is good. Thank you your your help.