I have noticed that Safari on macOS does not update the SDR/HDR information about the display on which it is displayed if you refresh the page.
Specifically if I use this query and set my MacBook Pro monitor to XDR the result will be "HDR true", but if I then set the monitor to a non-HDR mode like "Photography P3" and refresh the page the result is still the same. The only way is to close the tab, open a new one and launch the query again. This behaviour does not happen with chrome for example, a simple page refresh is enough.
The problem in common use can be found on YouTube with an HDR video. If the YouTube player page is already loaded and you change the monitor settings (from SDR to HDR or vice versa), you are forced to close and open a new browser window to have the player loaded with the correct video format.
You can check this behavior directly on the site I developed for the HDR test wide-gamut.com
It would definitely be more efficient if this information was updated simply by reloading the page.