2 November 2019

Use of JavaScript and Cookies

I strive to make this web site accessible and standards compliant, but I do use a small amount of JavaScript functionality.  Every design choice is a trade-off, and here are a few that I've made. 

Visual Choice

I have always preferred dark theme, meaning gray to white text on a near-black background.  However, I know that most people prefer a light theme, so that is the first stylesheet loaded.  If an OS/Browser combination supports communication a dark-mode choice, JavaScript will automatically choose the dark mode.  This can be overridden by a LIGHT/DARK graphic on the top of most pages, which also requires JavaScript.  Getting a choice to stick as one navigates through this site requires a cookie, set by JavaScript.  While that cookie is presented to my web-servers, my server does not use or log that visual choice. 

My E-mail Address

I really don't want to hide my e-mail address, but if I put it in plain text, I get a LOT more junk e-mail than otherwise.  Thus, I use a JavaScript that obfuscates my e-mail address using a number of pretty basic tricks.  When the JavaScript is run, the e-mail address is produced in a readable and usable way.  While it is trivial for a spam-purposed web scraper to run the JavaScript, most don't seem to bother, even now. 

Without JavaScript support, my site should render with firstname at lastname dot com in the place where my e-mail address would normally appear, along with a link to this page.


Valid CSS!