DEV Community

Discussion on: How to make a browser console log wait until after a page reload

Collapse
 
moopet profile image
Ben Sinclair

You could say that if any of your users don't know where the "preserve log" button is then that's their problem, but you're kinder than that

I get what you're saying about making things easier on your users, but if your users are looking at the javascript console as part of their work, I think we're already into "power user" territory.

What you're describing doing, with holding a variable across page loads in a session, is usually called "flash messages" or something similar, and it's used on the back-end as well to do things like present success messages even after the POSTed form has redirected to another page via header location response.

If you're depending on people reading the log, you could potentially improve the UX by beginning each page load with an informational message saying something like:

This is the log for Awesome Project.
Please ensure that your have "preserve log" turned on in your console settings. For more information, please consult our documentation

My concern is that if you're using the console to tell people things, then they presumably need to see other console messages which will be lost without "preserve log". On the other hand, they'll now need to clear it manually or it'll get overwhelming!

I can't think of any real-life process where people would use the log for out-of-band information that couldn't be displayed in a different way.

Collapse
 
tymick profile image
Ty Mick

That makes sense. And it looks like the Next.js team thought of something even better, actually: adding an informative overlay to the page in the dev server when the first full reload occurs.