I'm trying to personalize titles for a certain Angular website, but the title does not change back to anything (it persists as the modified state) even after visiting different pages unless. Now, the page itself does NOT refresh when changing pages so the DOM itself is not refreshed (otherwise the title does change); but, the usual behavior is that the title does in fact change whenever a different page is opened regardless of whether or not the page refreshed completely.
This is really all I am doing right now...
let observer = new MutationObserver(function(mutations) {
let tab_url_split = location.href.split("/")
if (tab_url_split[3] == "example") {
document.title = "example title"
}
});
observer.observe(document, {
subtree: true,
attributes: true
//...
});
Expected Behaviour: Title reverts to default (as set by devs) when page changes
Actual Behaviour: Title never changes until I refresh the page.
The website itself is not very complicated so I am considering manually mapping URLs to certain titles if no other solution...