I'm using some Ajax/other code (from https://jesse.sh/rethinks-dynamic-page-replacing-content/) to load partial page content into a specific div.
As it doesn't grab the title of the new content, the page title unhelpfully remains that of the initially-loaded page.
Unable to find a solution which handles the title appropriately, I'm using a kludge of 'console.log(href);' with 'document.title = location.href.replace ()' to produce an url-based title, from which are then removed the http:// and various other things before the page title.
It seems to work, but requires me to think about just what needs to be removed and chain accordingly.
In the absence of some code which replaces the title accordingly and thus doesn't require the above kludge, I'd like to be able to use a single unchained 'replace' which removes everything before the page title.
However, I don't understand enough to be able to do so.
Suggestions appreciated - please/thanks/etcetera.