0

I'm trying to unload SharePoint JS files, such as core.js, init.js and other unnecessary JS files in order to enhance site performance and to achieve SEO standards as well.

Currently I'm using the SPSecurityTrimmedControl tag to achieve my goal as below:

<SharePoint:SPSecurityTrimmedControl runat="server" AuthenticationResctriction="AuthenticateUsersOnly">

    <SharePoint:ScriptLink Language="javascript" Name="core.js" OnDemand="true" runat="server" Localizable="false" />
    <SharePoint:ScriptLink Language="javascript" Name="menu.js" OnDemand="true" runat="server" Localizable="false" />
    <SharePoint:ScriptLink Language="javascript" Name="callout.js" OnDemand="true" runat="server" Localizable="false" />
    <SharePoint:ScriptLink Language="javascript" Name="sharing.js" OnDemand="true" runat="server" Localizable="false" />
    <SharePoint:ScriptLink Language="javascript" Name="suitelinks.js" OnDemand="true" runat="server" Localizable="false" /></SharePoint:SPSecurityTrimmedControl>

Problem is when an authenticated user is logged in and try to use the ribbon and click on any tab such as Page or Publish tab, it does not show the content of that tab, it keeps displaying a message "Working on it" as shown below:

enter image description here

Any help is much appreciated.

1 Answer 1

0

I had same issue, I get it working with:

<script type="text/javascript" src="/_layouts/15/init.js"></script>
<Sharepoint:SPSecurityTrimmedControl runat="server"  Permissions="AddAndCustomizePages">
    <SharePoint:ScriptLink language="javascript" name="core.js"  OnDemand="true"  runat="server"  />                
    <SharePoint:ScriptLink ID="ScriptLink1" Name="SP.js" runat="server" OnDemand="false" LoadAfterUI="true" Localizable="false"/>
</SharePoint:SpSecurityTrimmedControl>

So anonymous have quite clean page and authenticated users get their stuff, but it's quite weird way

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.