DEV Community

Cover image for HTTP 468 - Keyboard Required (Meme HTTP Code)
Yan Levin
Yan Levin

Posted on • Edited on

HTTP 468 - Keyboard Required (Meme HTTP Code)

Introduction

In today's world of sleek touchscreens and voice assistants, you'd think we've moved past the humble keyboard, right? Wrong! Some tasks still need the good ol' clackety-clack of physical keys. Enter HTTP 468 - the status code you never knew you needed, telling you to stop tapping and start typing.

The Curious Case of Status Code 468

Why 468? Well, let's take a time machine back to 1868 when Christopher Latham Sholes, the father of the typewriter, patented his clunky contraption that eventually led to our beloved keyboards. So, 468 is our little tip of the hat to Sholes, acknowledging that sometimes, history does repeat itself (especially if you’re a developer).

Why HTTP 468 Makes Sense (Seriously)

Despite our futuristic tech, there are still moments when a physical keyboard is non-negotiable:

  1. Novels, Not Novellas: Writing that epic fantasy novel on a touchscreen? Good luck. Real writers use real keyboards.
  2. Gaming Glory: Imagine playing a game with on-screen buttons. No, thank you. Gamers know the importance of physical keys for those crucial combos.
  3. Coder’s Paradise: Trying to code an app on a tablet? That's a no from us. Shortcuts and key commands are life.

Bringing HTTP 468 to Life

Implementing HTTP 468 is as simple as it gets. Here's a quick example to show you how:

Example in Express.js

const express = require('express');
const app = express();

function checkForPhysicalKeyboard(req) {
  // Logic to determine if the client has a physical keyboard
  return false; // Assuming no keyboard for demonstration
}

app.get('/requires-keyboard', (req, res) => {
  const hasPhysicalKeyboard = checkForPhysicalKeyboard(req);

  if (!hasPhysicalKeyboard) {
    res.status(468).send('Keyboard Required');
  } else {
    res.send('Proceed with the function');
  }
});

app.listen(3000, () => {
  console.log('Server is running on port 3000');
});
Enter fullscreen mode Exit fullscreen mode

In this snippet, if your fancy device doesn’t have a keyboard, you’re getting a friendly reminder in the form of a 468 status code.

Handling HTTP 468 on the Client Side

When your device gets a 468, it’s like the server giving you a nudge and saying, "Hey, buddy, where's your keyboard?" Here's how to handle it:

Example in JavaScript (Client-Side)

fetch('/requires-keyboard')
  .then(response => {
    if (response.status === 468) {
      alert('This function requires a physical keyboard. Please connect a keyboard and try again.');
    } else {
      return response.text();
    }
  })
  .then(data => {
    if (data) {
      console.log(data);
    }
  });
Enter fullscreen mode Exit fullscreen mode

When you get a 468, it’s time to pull out that Bluetooth keyboard or dust off the old mechanical beast.

Conclusion

HTTP 468 (Keyboard Required) is your server's way of saying, "Stop being lazy and plug in a keyboard." It's a reminder that while our devices get smarter, sometimes, we need to go back to basics. So next time you find yourself in need of serious typing power, remember Christopher Latham Sholes and thank him for making HTTP 468 possible.

Give HTTP 468 a try in your projects, and ensure your users know that sometimes, nothing beats the tactile joy of a physical keyboard. And hey, if you like the idea, check out the GitHub repo and give it a star! Let's spread the love for physical keyboards and better server-client interactions.

Top comments (18)

Collapse
 
schmoris profile image
Boris

// Logic to determine if the client has a physical keyboard

That would have been the interesting part 🤓

Collapse
 
henrywoody profile image
Henry Woody • Edited

I've looked into this in the past on the client-side and found this question: How do I detect hardware keyboard presence with javascript?, but it doesn't have any great answers. The lowest-score answer might actually be the best answer:

if (confirm('Do you have hardware keyboard?')) {

} else {

}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
schmoris profile image
Boris

Lol, love this one!

Collapse
 
skyzerozx profile image
SkyZeroZx • Edited

I think is possible detect with user agent of certain device how mobile ?

Collapse
 
michaelmior profile image
Michael Mior

A mobile device can have a physical keyboard connected.

Collapse
 
p12y profile image
Peter Tyldesley

Yep. Instead what we got was a tutorial about how to return a status code in express.

Collapse
 
luna_dev profile image
Luna

My favourite HTTP code is still:
418 I'm a teapot

developer.mozilla.org/en-US/docs/W...

Collapse
 
ashleyd480 profile image
Ashley D

Oooh excellent share @m_midas. We were learning last month in bootcamp about error code specific to calls to endpoints from the frontend. Love this nifty error status you shared for where keyboard is required, as well as the code snippet so we can see how it's implemented. 🦄

Collapse
 
risha_mason_45d3b388851f8 profile image
Risha Mason

Hah this is so funny

Collapse
 
khuongduybui profile image
Duy K. Bui • Edited

EDIT: There is a #jokes tag that I missed. Well-played.

I can't tell if this is supposed to be a prank (like April's Fools), a proposal, or guide.
If a prank, it should be noted somewhere.
If a proposal, dev.to this is not the best place to propose HTTP standards.
If a guide, this is a misleading guide as many other folks have pointed out.
And finally, the linked GitHub repo does not contain any code.

Collapse
 
m_midas profile image
Yan Levin

Can’t get kind of code are you expecting on meme HTTP code.
I’ll mark additionally that its meme code. Thanks

Collapse
 
khuongduybui profile image
Duy K. Bui

I missed the #jokes tag lol

Collapse
 
crazytonyi profile image
Anthony

"452-499 Unassigned"

Doesn't sound official. Probably for good reason.

This puts a huge limitation on a site or web app, very similar to the dark ages when sites wouldn't load because the browser wasn't IE because the development backend was "just trying to avoid problems"

It's really none of your business as a developer if someone wants to play a keyboard based game from their mobile keyboard. Or write a novel. Or anything else. If they struggle to do so and continue to do so anyway, that's their decision, not your problem to solve.

You really run into the risk of being ableist with this mindset. Many people code with non keyboards because they physically can't use a keyboard. When you force a site to use a keyboard, you block out groups of people.

Collapse
 
m_midas profile image
Yan Levin

HTTP 468 is a humorous status code. In real applications, of course, stick to official codes.

As for limitations and IE: sounds like some traumatic memories there. We've all been through that, but it doesn't mean physical keyboards are bad. Yes, everyone has their preferences, but sometimes it's worth reminding that sometimes playing games on an on-screen keyboard is like trying to hammer a nail with a banana.

Collapse
 
normanc8 profile image
Tom C. • Edited

So this is how search engines get poisoned with b*s.

It's sad dev.to provides 5 ways to cheer but none to call out nonsense posts.

Collapse
 
khuongduybui profile image
Duy K. Bui

You can report to moderators, they can mark content as low quality for further reviews.

Collapse
 
p12y profile image
Peter Tyldesley

If you have to use the client to check if the client has a physical keyboard, there's literally no point to the server side code in your example.

Collapse
 
m_midas profile image
Yan Levin

The major point is about status code, not the code in the example