Build note
Making a greeting appear once per session
A small change to keep my portfolio’s introduction personal without making returning visitors wait through it again.
The greeting started getting in the way
My portfolio has a short greeting that cycles through English, Japanese, and Nepali. I liked the personality it added, but watching those same three or four seconds again when returning to the homepage felt unnecessary.
Honestly, once you’ve seen the introduction, you probably just want to see the work.
In my Next.js portfolio, I use sessionStorage to show the greeting once per browser tab session.
- EnglishHello.
- Japaneseこんにちは.
- Nepaliनमस्ते.
What “once” should mean
I wanted “once per session” to mean once within a browser tab:
| Scenario | Expected behavior |
|---|---|
| First homepage visit | Play the greeting. |
| Refresh in the same tab | Skip it. |
| Navigate away and return | Skip it. |
| Refresh halfway through the greeting | Still skip it. |
| Open the homepage in a fresh, independent tab | Allow it to play again. |
The greeting belongs to the homepage, so visiting another page first shouldn’t count as having seen it.
Remembering the first hello
The implementation uses sessionStorage with a flag called rupak:intro-seen:v1.
One small detail matters here: the flag gets saved when the greeting starts, rather than when it finishes. Otherwise, someone refreshing halfway through would have to watch it again.
There’s also an early inline check that hides the overlay before the page paints when the flag already exists. So, skipping the greeting should feel immediate, without a quick flash of the loader. An in-memory guard handles duplicate animation starts within the running page.
A little personality, with limits
I kept the greeting because, well, I still like it. The different languages make the site feel a little more personal. I just don’t want that detail to keep getting in someone’s way.
The first visit still comes with a delay. Reduced-motion visitors get a shorter, simpler version.
There are limits too. If session storage is unavailable, the fallback only remembers within the current page load, so refreshing can replay it. And a duplicated tab copies the session, so it skips the greeting too, even though it’s technically a new tab.
What I checked
Once the implementation was in, I went through each case in the browser before calling any of these behaviours tested.
My checklist was:
Checked in the browser
- First visit
- Refresh
- Navigation back home
- Refresh midway through
- A fresh tab
- A duplicated tab
- Browser back/forward
- Reduced motion
- Blocked storage
All nine behaved the way I intended, including the limits above.