Home Community Uploads
image

Cireson Partners, Customers and Community members share your customizations and examples here to help benefit the community as a whole to earn Kudos and badges.

DISCLAIMER

All files and projects located here are provided and come "as-is" and without any warranty or support. Use at your own risk. Your use of Community Uploads is subject to our Terms of Use.

Cireson does not and will not support or maintain these enhancements, extensions, and scripts.

For Team Cireson uploads click here.

Custom Page Title

Cory_BoweCory_Bowe Customer Adept IT Monkey ✭✭
edited March 2017 in Community Uploads
This small function will set the page title. Copy to your custom.js and modify the pageNameToPrepend variable.

//Set the page title<pre class="CodeBlock"><code>
$(document).ready(function() {
    pageNameToPrepend = "MCIS Portal"
    timerPageTitle = false;
    setTimeout(function() { timerPageTitle = true; }, 1000);
    var mainPageNode = document.getElementById('main_wrapper');
    var observerPageTitle = new MutationObserver(function(mutations) {
        if (document.title.length > 0 || timerPageTitle) {
            if (document.title.match("^" + pageNameToPrepend + " ") === null) {
                if (document.title) {
                    document.title = pageNameToPrepend + " - " + document.title;
                } else {
                    document.title = pageNameToPrepend + " - " + document.URL;
                };
            }
            observerPageTitle.disconnect();
        }
    });
    var observerPageTitleConfig = {
        attributes: true,
        childList: true,
        subtree: true,
        characterData: true
    };
    observerPageTitle.observe(mainPageNode, observerPageTitleConfig);
});
//End set the page title

Thank you @Martin_Blomgren for the idea.
Sign In or Register to comment.