I have included some javascript to a master page of a site collection. The script makes a clickable button directs to two sites which when an internal user click on it user directs to a internal accessible site while an external user click it directs to a external accessible site.
This button appears in all the sites except when I go to the site settings page of a particular site page.
Does that means the script is not working in site settings page? It works in site settings when I activate SharePoint Server Publishing feature in site features.
I'll add the code below you to clarify the issue
<script type="text/javascript">
var clientContext;
var user;
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady);
function sharePointReady() {
clientContext = SP.ClientContext.get_current();
user = clientContext.get_web().get_currentUser();
clientContext.load(user);
clientContext.executeQueryAsync(onQuerySucceeded, onQueryFailed);
}
function onQuerySucceeded() {
var cuser = user.get_email();
userem = cuser.replace(/.*@/, "");
if (userem == "xxx.com") {
document.getElementById("homehelp").innerHTML = "<a id='bookmarkmy' href='site url for internal users' title='Click here for help with this portal' target='_blank'><img src='image url' width='20px' height='20px' style='margin-bottom:-5px;'> HELP</a>";
} else {
document.getElementById("homehelp").innerHTML = "<a id='bookmarkmy' href='site url for external users' title='Click here for help with this portal' target='_blank'><img src='image url' width='20px' height='20px' style='margin-bottom:-5px;'> HELP</a>";
}
}
function onQueryFailed(sender, args) {
alert('Error: ' + args.get_message());
}
</script>