Skip to content

New remove js files option #20

Description

@Timo-Breumelhof

Try:

   Protected Overrides Sub OnPreRender(ByVal e As EventArgs)

    Dim objLibraries = DotNetNuke.Framework.JavaScriptLibraries.JavaScriptLibraryController.Instance.GetLibraries()

    For Each library As DotNetNuke.Framework.JavaScriptLibraries.JavaScriptLibrary In objLibraries
           If library.LibraryName = "jQuery" Then
                  ' always remove jquery
                  HttpContext.Current.Items.Remove("JSL." & library.JavaScriptLibraryID.ToString())
           End If

           If library.LibraryName = "jQuery-UI" Then
                  Dim remove = True

                  If Request.IsAuthenticated Then
                         Dim objUser = DotNetNuke.Entities.Users.UserController.Instance.GetCurrentUserInfo()
                         If objUser IsNot Nothing Then
                                If objUser.IsInRole("Administrators") OrElse DotNetNuke.Common.Globals.IsEditMode() Then
                                       remove = False
                                End If
                         End If
                  End If


                  If remove Then
                         HttpContext.Current.Items.Remove("JSL." & library.JavaScriptLibraryID.ToString())
                  End If
           End If
    Next

End Sub 

Activity

  1. Timo-Breumelhof commented on Apr 11, 2022

    @Timo-Breumelhof
    ContributorAuthor

    Does not seem to work.. :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions