logoalt Hacker News

masswerk05/04/20251 replyview on HN

Fun fact: this does work with iframes:

  <ul>
    <li><a href="about.html" target="display">about</a></li>
    <li><a href="contact.html" target="display">contact</a></li>
  </ul>

  <iframe src="about.html" name="display"></iframe>
The important part is that the target iframe must have a `name` attribute (not identified by `id`.) I guess, this is a legacy of framesets & frames.

(Of course, this has all the issues of framesets, as in deep linking, accessibility, etc.)


Replies

charrondev05/04/2025

The worst part of frames is scrolling.

You have to give an iframe a specific height in pixels. There is no “make this iframe the height its content wants to be (like normal HTML).

This leads to two options:

- your page has nested vertical scroll bars (awful UX) - you have to write JavaScript inside and outside the frame to constantly measure and communicate how tall the frame wants to be.

Or you could just not use frames.

show 1 reply