There's certainly nothing wrong with using a cookie for this, but it is, alternatively, entirely possible to monitor open tabs on the client side, using localStorage.
The example below listens for page load and unload events:
when a page is loaded, a new entry is added to localStorage
when a page is unloaded, the last entry is removed from localStorage
Move your revert all logic to the top of the function to avoid having to exclude the newly active item.
Use a stateful class such as .is-active instead of message-head-active. Means you only have to toggle 1 class rather than 2.
toggleClass accepts multiple arguments so you can toggle the FontAwesome classes in one line. This also removes the need for the ...
For those who dont like typed.js, Modified code for the user code is.
content -> is the text that shows the typing effect.
speed -> is the typing effect speed. i -> this will help in
iterating over the content till it reaches the content length.
timer -> we use this variable to assign the setTimeout(), so
that after the text content is looped, ...