I’m rubbish in javascript, but I need to do a little dynamic editing of my page title in the tab bar on my php site.
When the user on my site gets a mail, I want to change the title from “My site – Page” to “My Site (1) – Page”
I know how to change the page title with
<script>
window.parent.document.title = "My Site (x)";
</script>
But what I need to do is grab the current title, eg “My Site – Page”, and change it to “My Site (x) – Page”. So I would need some twiddling with the string.
Don’t worry about what the x is, I just need a hand with the javascript not the PHP.
This should work (change X as needed):
Or you can simply do:
EDIT: Dynamic ‘page’ part: