New Dec 23, 2024

Making o(m)g:image, Part IV: URLs

More Front-end Bloggers All from Jim Nielsen’s Blog View Making o(m)g:image, Part IV: URLs on blog.jim-nielsen.com

This is part four of my series of posts describing how I made my quiz game o(m)g:image.

The design of the game is simple:

My first thought is to make each question a <form> with some <input> radios, e.g.

<img src="question-1.jpg">
<form action="/questions/1/">
  <label>
    <input type="radio" name="answer" value="1">
    First answer
  </label>
  <label>
    <input type="radio" name="answer" value="2">
    Second answer
  </label>
  <!-- the other 2 questions -->
</form>

That makes a lot of sense for a quiz, but I realize that it necessitates a URL structure like this:

Why search params? Because that’s how a native HTML <form> submission works by default.

But I don’t want that because it requires either 1) something other than a static file server, or 2) client-side JavaScript.

With this project, I know what I don’t want:

So what do I do? I use the same technology used on the SpaceJam website from 1996 to present a quiz: links!

<img src="question-1.jpg">
<a href="questions/1/answers/1">First answer</a>
<a href="questions/1/answers/2">Second answer</a>
<!-- other 2 answers -->

This allows me to have a URL structure like this:

Which allows for:

Form submissions as well as links can be navigations.

It’s boring — almost feels unworthy of a blog post — but it’s solid approach to making a website that will require very little intervention in the coming years/decades. Hopefully this quiz lasts as long as the SpaceJam one from 1996.


Reply via:

Email :: Mastodon ::

Bluesky

Tagged in: #omgImg

Related posts linking here: (2024) Making o(m)g:image, Part I: Design Iterations ::(2024) Making o(m)g:image, Part II: As Little JS As Possible ::(2024) Making o(m)g:image, Part III: The HTML

Scroll to top