Thank you Barry - once again my infinite faith has been justified, but I'll have to study it a while. No doubt I'll be getting back to you ... However, do I understand right that I'll have to add something to the top of ALL my pages? Your no. 1 fan, Caroline Hi everyone, Recently Caroline was looking for a way of displaying a "note" when a visitor entered her site via a link that may have directed them to a page far removed from a directory index page. The "note" would only be displayed on the initial entry to the site, and any subsequent navigation within the site wouldn't cause the "note" to be displayed again. Essentially, this requires that the user's browser be given a cookie when it first visits the site, while at the same time displaying the "note". The "note" can be closed by the user, and they can then navigate around the site while the cookie prevents the "note" being displayed again. The cookie is a text file, but in our case the cookie itself will be created using Javascript and stored in the browser cache for 30 days, or such other number of days the site owner requires. This same file provides means of dynamically creating the "note", styling and displaying it, complete with a "close" button. Our cookie text file is stored in your freepages community root directory, e.g. freepages.genealogy.rootsweb.ancestry.com/~myaccount/ and is accessible using the same address from anywhere in the ~myaccount genealogy community. Using SSI - (Server Side Includes) is the simplest method of doing this, and the address for the "freepages-cookie.txt" file is as follows:- <!--#include virtual="/~myaccount/freepages-cookie.txt" --> ... which is placed in the <head> section of each of your pages. That is all you have to do, and just changing the text for the note in one file [freepages-cookie.txt] is all that may need to be done in the future. As an example, I've placed a couple of identical html pages in my "misc" root directory at:- http://freepages.rootsweb.ancestry.com/~bristowe/cookie-test.html and http://freepages.rootsweb.ancestry.com/~bristowe/cookie-test-2.html The only differences are in the <title>; Cookie Test, and Cookie Test 2. There is a single style in the head section, but that is just fixing the Rootsweb footer at the bottom of the open window. The head section looks as follows:- <!doctype html> <html> <head> <meta charset="utf-8"> <title>Cookie Test</title> <link rel="stylesheet" href="#"> <!--#include virtual="/~bristowe/freepages-cookie.txt" --> <style> #fp_ftr {position:fixed;bottom:0} </style> </head> ...the same files are also in the /test/ directory - http://freepages.rootsweb.ancestry.com/~bristowe/test/cookie-test.html and http://freepages.rootsweb.ancestry.com/~bristowe/test/cookie-test-2.html For demonstration purposes the first file you access will show the "note" [Hello World!] and a close button, and the page background will be Cyan. Open another tab and paste the same url into it; this time the page will come up with a Magenta background and no "note". Go back to the first page, close the "note" and refresh the page. It will now have a Magenta background. If you download the freepages-cookie.txt file from - http://freepages.rootsweb.ancestry.com/~bristowe/freepages-cookie.txt ... and open it, you'll notice that it is made up of <script> and <styles>. Provided you dont go back to any of these pages until after 30 days has passed, your next visit will show the the "note" once more. Clearing your browser's cache will allow the cookie to reset when you next visit either of the above pages. Barry ____ "Tilberia" http://freepages.family.rootsweb.com/~cmtilbury "TheTilbury Magazine" http://freepages.genealogy.rootsweb.ancestry.com/~cmtilbury/ttm/ttm_frontpage.html Every path has its puddle. Life has no reverse gear. NB: an e-mail message remains the Intellectual Property of the sender; traffic on this e-mail server may be normally subject to UK and French copyright law. -----Original Message----- From: Barry Carlson via <[email protected]> To: freepages-help <[email protected]> Sent: Mon, Jun 13, 2016 7:09 am Subject: [FreeHelp] Setting a Cookie in Freepages Hi everyone, Recently Caroline was looking for a way of displaying a "note" when a visitor entered her site via a link that may have directed them to a page far removed from a directory index page. The "note" would only be displayed on the initial entry to the site, and any subsequent navigation within the site wouldn't cause the "note" to be displayed again. Essentially, this requires that the user's browser be given a cookie when it first visits the site, while at the same time displaying the "note". The "note" can be closed by the user, and they can then navigate around the site while the cookie prevents the "note" being displayed again. The cookie is a text file, but in our case the cookie itself will be created using Javascript and stored in the browser cache for 30 days, or such other number of days the site owner requires. This same file provides means of dynamically creating the "note", styling and displaying it, complete with a "close" button. Our cookie text file is stored in your freepages community root directory, e.g. freepages.genealogy.rootsweb.ancestry.com/~myaccount/ and is accessible using the same address from anywhere in the ~myaccount genealogy community. Using SSI - (Server Side Includes) is the simplest method of doing this, and the address for the "freepages-cookie.txt" file is as follows:- <!--#include virtual="/~myaccount/freepages-cookie.txt" --> ... which is placed in the <head> section of each of your pages. That is all you have to do, and just changing the text for the note in one file [freepages-cookie.txt] is all that may need to be done in the future. As an example, I've placed a couple of identical html pages in my "misc" root directory at:- http://freepages.rootsweb.ancestry.com/~bristowe/cookie-test.html and http://freepages.rootsweb.ancestry.com/~bristowe/cookie-test-2.html The only differences are in the <title>; Cookie Test, and Cookie Test 2. There is a single style in the head section, but that is just fixing the Rootsweb footer at the bottom of the open window. The head section looks as follows:- <!doctype html> <html> <head> <meta charset="utf-8"> <title>Cookie Test</title> <link rel="stylesheet" href="#"> <!--#include virtual="/~bristowe/freepages-cookie.txt" --> <style> #fp_ftr {position:fixed;bottom:0} </style> </head> ...the same files are also in the /test/ directory - http://freepages.rootsweb.ancestry.com/~bristowe/test/cookie-test.html and http://freepages.rootsweb.ancestry.com/~bristowe/test/cookie-test-2.html For demonstration purposes the first file you access will show the "note" [Hello World!] and a close button, and the page background will be Cyan. Open another tab and paste the same url into it; this time the page will come up with a Magenta background and no "note". Go back to the first page, close the "note" and refresh the page. It will now have a Magenta background. If you download the freepages-cookie.txt file from - http://freepages.rootsweb.ancestry.com/~bristowe/freepages-cookie.txt ... and open it, you'll notice that it is made up of <script> and <styles>. Provided you dont go back to any of these pages until after 30 days has passed, your next visit will show the the "note" once more. Clearing your browser's cache will allow the cookie to reset when you next visit either of the above pages. Barry ------------------------------- To unsubscribe from the list, please send an email to [email protected] with the word 'unsubscribe' without the quotes in the subject and the body of the message
Caroline, Your understanding about adding an #include link in the head section of every page is correct. Notwithstanding this monumental task, there is now a well developed Freeware program - "Find and Replace" that is capable of finding/replacing multiple lines of text in whatever directories and files you select. More importantly it backs-up your original files into a Temp directory (default or selectable). There is a small learning curve in getting used to how it operates. The easiest method of inserting the #include into the head section is to find - in the directory and sub-directories of files/types you select, then - use the replace function to enter, e.g. ... and that is exactly what is entered - no extra lines etc.. http://findandreplace.sourceforge.net/ Scroll down to the bottom to see the link to the Download page; there is no malware in the file. Barry On 14/06/2016 09:22, TilburyCM wrote in part: > Thank you Barry - once again my infinite faith has been justified, but I'll have to study it a while. No doubt I'll be getting back to you ... However, do I understand right that I'll have to add something to the top of ALL my pages? > >> // . >> >> Provided you dont go back to any of these pages until after 30 days has >> passed, your next visit will show the the "note" once more. Clearing >> your browser's cache will allow the cookie to reset when you next visit >> either of the above pages. >> >> Barry > > ____ > > "Tilberia" http://freepages.family.rootsweb.com/~cmtilbury > "TheTilbury Magazine" http://freepages.genealogy.rootsweb.ancestry.com/~cmtilbury/ttm/ttm_frontpage.html > > _Every path has its puddle. Life has no reverse gear._ > > NB: an e-mail message remains the Intellectual Property of the sender; traffic on this e-mail server may be normally subject to UK and French copyright law. > > -----Original Message----- > From: Barry Carlson via > To: freepages-help > Sent: Mon, Jun 13, 2016 7:09 am > Subject: [FreeHelp] Setting a Cookie in Freepages > > Hi everyone, > > Recently Caroline was looking for a way of displaying a "note" when a > visitor entered her site via a link that may have directed them to a > page far removed from a directory index page. The "note" would only be > displayed on the initial entry to the site, and any subsequent > navigation within the site wouldn't cause the "note" to be displayed > again. > > Essentially, this requires that the user's browser be given a cookie > when it first visits the site, while at the same time displaying the > "note". The "note" can be closed by the user, and they can then navigate > around the site while the cookie prevents the "note" being displayed > again. > > The cookie is a text file, but in our case the cookie itself will be > created using Javascript and stored in the browser cache for 30 days, or > such other number of days the site owner requires. This same file > provides means of dynamically creating the "note", styling and > displaying it, complete with a "close" button. Our cookie text file is > stored in your freepages community root directory, e.g. > freepages.genealogy.rootsweb.ancestry.com/~myaccount/ and is accessible > using the same address from anywhere in the ~myaccount genealogy > community. > > Using SSI - (Server Side Includes) is the simplest method of doing > this, and the address for the "freepages-cookie.txt" file is as > follows:- > > ... which is placed in the section of each of your pages. That > is all you have to do, and just changing the text for the note in one > file [freepages-cookie.txt] is all that may need to be done in the > future. > > As an example, I've placed a couple of identical html pages in my > "misc" root directory at:- > > http://freepages.rootsweb.ancestry.com/~bristowe/cookie-test.html [1] > and > http://freepages.rootsweb.ancestry.com/~bristowe/cookie-test-2.html [2] > > The only differences are in the ; Cookie Test, and Cookie Test > 2. There is a single style in the head section, but that is just fixing > the Rootsweb footer at the bottom of the open window. The head section > looks as follows:- > > Cookie Test > > * > > ...the same files are also in the /test/ directory - > > http://freepages.rootsweb.ancestry.com/~bristowe/test/cookie-test.html [3] > and > http://freepages.rootsweb.ancestry.com/~bristowe/test/cookie-test-2.html [4] > > For demonstration purposes the first file you access will show the > "note" [Hello World!] and a close button, and the page background will > be Cyan. Open another tab and paste the same url into it; this time the > page will come up with a Magenta background and no "note". Go back to > the first page, close the "note" and refresh the page. It will now have > a Magenta background. > > If you download the freepages-cookie.txt file from - > > http://freepages.rootsweb.ancestry.com/~bristowe/freepages-cookie.txt [5] > > ... and open it, you'll notice that it is made up of and > . > > Provided you dont go back to any of these pages until after 30 days has > passed, your next visit will show the the "note" once more. Clearing > your browser's cache will allow the cookie to reset when you next visit > either of the above pages. > > Barry > > ------------------------------- > To unsubscribe from the list, please send an email to [email protected] [6] with the word 'unsubscribe' without the quotes in the subject and the body of the message // ]]> Links: ------ [1] http://freepages.rootsweb.ancestry.com/%7Ebristowe/cookie-test.html [2] http://freepages.rootsweb.ancestry.com/%7Ebristowe/cookie-test-2.html [3] http://freepages.rootsweb.ancestry.com/%7Ebristowe/test/cookie-test.html [4] http://freepages.rootsweb.ancestry.com/%7Ebristowe/test/cookie-test-2.html [5] http://freepages.rootsweb.ancestry.com/%7Ebristowe/freepages-cookie.txt [6] mailto:[email protected]