Detect “Do Not Track” with JavaScript
Do Not Track is an excellent idea. The DNT website describes it best:
Do Not Track is a technology and policy proposal that enables users to opt out of tracking by websites they do not visit, including analytics services, advertising networks, and social platforms. At present few of these third parties offer a reliable tracking opt out, and tools for blocking them are neither user-friendly nor comprehensive. Much like the popular Do Not Call registry, Do Not Track provides users with a single, simple, persistent choice to opt out of third-party web tracking.
The preference is sent from the client to the server via a HTTP header but you can also get its value using JavaScript:
// "1" or "unspecified"
if(navigator.doNotTrack == 1) {
// Do (or don't do) stuff.
}
If you wanted to be extreme about honoring your user's preference, you could use that to lazyload (or not) advertising, analytics, or other utilities. Probably a bit extreme but it's there for you to use!
Today we get to play amazing games on our super powered game consoles, PCs, VR headsets, and even mobile devices. While I enjoy playing new games these days, I do long for the retro gaming systems I had when I was a kid: the original Nintendo...
I was inspired when I first saw Addy Osmani's original ShineTime blog post. The hover sheen effect is simple but awesome. When I started my blog redesign, I really wanted to use a sheen effect with my logo. Using two HTML elements and...
The jQuery homepage has a pretty suave tooltip-like effect as seen below:
Here's how to accomplish this same effect using Dojo.
The XHTML
The above HTML was taken directly from the jQuery homepage -- no changes.
The CSS
The above CSS has been slightly modified to match the CSS rules already...
I was recently visiting MooTools Developer Christoph Pojer's website and noticed a sexy link hover effect: when you hover the link, the the link animates and tilts to the left or the right. To enhance the effect, the background color of the link is...
Is the resulting value always a string or an integer except when unspecified (then it is a string), and are the values you stated the same cross-browser (especially the unspecified value)?
I really like how medium handles DNT.