SPSecurityTrimmedControl isn't executed in the edit mode
-
12-12-2020 - |
سؤال
When I click on Edit Page button the code below doesn't execute, but I have all permissions:
<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server" PermissionsString="ViewPages">
<script type="text/javascript">
document.getElementById("suiteBar").style.display = "block";
if (document.getElementById("Ribbon") != null) {
document.getElementById("s4-ribbonrow").style.display = "block";
}
</script>
</SharePoint:SPSecurityTrimmedControl>
المحلول
I've found the reason. The problem was in this condition - if (document.getElementById("Ribbon") != null)
but no in SharePoint:SPSecurityTrimmedControl
. Thank's everyone for your answers.
نصائح أخرى
Try to run this code after sharepoint UI is loaded:
_spBodyOnLoadFunctions.push(function(){
document.getElementById("suiteBar").style.display = "block";
if (document.getElementById("Ribbon") != null) {
document.getElementById("s4-ribbonrow").style.display = "block";
}
});
لا تنتمي إلى sharepoint.stackexchange