I'm curious how various websites use the console.log()
function to be always located at the bottom, just like Facebook and Discord. Once the console is opened, my function should follow any previous/new console messages and be shown underneeth them.
Asked
Active
Viewed 88 times
0

Bella
- 104
- 17

Paweenwat Maneechai
- 215
- 3
- 15
-
You have two distinct questions. You should limit it to one and post a separate question if needed. – Brian Thompson Apr 08 '22 at 20:05
-
Does this answer your question? [Stylized console logging](https://stackoverflow.com/questions/26283936/stylized-console-logging) – Mushroomator Apr 08 '22 at 20:10
-
@Mushroomator Honestly, I'm curious about how it logging if user open the web browser's console. – Paweenwat Maneechai Apr 08 '22 at 20:14
-
Do you mean it should show at the bottom/start when the console is open or just log the message? – Bella Apr 08 '22 at 20:17
-
@Bella When the console is open, logging the message as follow. – Paweenwat Maneechai Apr 08 '22 at 20:20
-
Please be more spesific. You want the function to be always localised at the bottom? – Bella Apr 08 '22 at 20:24
-
@Bella Yes, the Function will be always localised to bottom as same as Facebook and Discord do. – Paweenwat Maneechai Apr 08 '22 at 20:29
-
If you write code with no errors... you could just print it on load and it'll *seem* like its printing when they open the console – Brian Thompson Apr 08 '22 at 20:34
1 Answers
1
A simple way of doing this would be to check when the window is resized. Since you can't check the console without resizing the page, it would work (this works with both horizontal and vertical dev tools).
window.addEventListener('resize', function () {
console.log('You resized this window or accessed the console.');
});
This could also be triggered when the window is resized, meaning that it would be better to use console.log()
than alert()
.