سؤال

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"; 
      }
});
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى sharepoint.stackexchange
scroll top