Scroll to top

21/03/2021


2021/03/21#p1

2 comments: click to read or leave your own

The use of JavaScript on the web can be very divisive, its abuses with trackers and privacy, and making pages excessively heavy are key reasons. Used correctly, however, it can enhance the experience and provide useful interactions.

I use a reasonably small amount of public-facing JavaScript to toggle comment sections, handle the highlighting of fragmentions and backlinks, etc. but nothing invasive. The code is the only way to achieve certain outcomes. I am aware that for some the distrust of JavaScript means they disable it – how they manage to operate when it is so pervasive I'll never know.

Still, with this in mind, I decided to add a little banner by way of a <noscript> tag should this be the case.

noscript

The banner is dismissable purely using CSS by means of a hidden checkbox and a :not(:checked) condition – click the X and the div disappears.

Without JavaScript I can't set a cookie to remember this without reloading the page and using $_GET to set a PHP session variable but I think that's overkill.

avatar
wearsmanyhats says: Reply to wearsmanyhats

@colinwalker Progressive enhancement is how the web should work. That those designing and building websites seem to have gotten that backwards is perhaps the biggest retrograde step in the development of the web, after the enclosure of most content by social media and apps.

avatar
Colin Walker replied:

I'm guilty here to a degree with comments but at least all the core content can be viewed okay. I think the problem is that technologies like JavaScript are so ubiquitous that we forget and opt for functionality over form.

Leave a reply



You can also:

Click here to reply using email Reply by email Send a webmention Send a Webmention



2021/03/21#p2

0 comments: click to leave a comment

I'm having issues with the microformats markup on comments not being recognised correctly where replies will contain the content of the post rather than their own. I don't know why and currently don't know how to fix it so will step back for a while and look at it with fresh eyes in a couple of days.

I was looking to the old WordPress plugin for comment webmentions for guidance but can't really see anything there to help.

No comments yet
Leave a reply



You can also:

Click here to reply using email Reply by email Send a webmention Send a Webmention



Close