Unit C · A page somebody else can use
What we are making: a page that refreshes on its own, so you can put the phone down and watch.
You found the problem yourself in session 11: a web page is a photograph. It shows the moment it loaded and then it stops being true, quietly, which is the worst way for something to stop being true.
The simplest fix is one line that tells the browser to come back on its own every few seconds. It is not the cleverest solution and real dashboards use something better, but it is one line and it turns a snapshot into something you can leave running.
content='1'. Then try content='30'.Refresh every second and the page is always current, the board is always busy, and the phone's battery drains. Refresh every thirty seconds and the board is free but the page is usually wrong. There is no correct answer, only a choice that suits what the thing is for.
Write down the interval you chose and one sentence saying why. A fire alarm and a greenhouse thermometer deserve very different answers.
| What you see | Why | What to do |
|---|---|---|
| The page flickers constantly | Refresh interval too short. | Anything under 2 seconds is uncomfortable to look at. |
| It stopped refreshing | The meta tag is in the body, not the head. | It has to be between <head> and </head>. |
| Refreshing loses what I pressed | Every refresh re-requests the same address. | Use the redirect from session 11 so the address goes back to /. |
| The board feels slow | Several phones all polling it. | That is real. Fewer requests, or a longer interval. |
In this session