Using a Different Version of jQuery via CDN

Overview

You may have custom modules that require a different version of jQuery than the one provided with DNN. Hence, you may need to use an alternative version of jQuery.

 

Prerequisites

 

Solution

Note: Please make a full backup of your site and database before following the process below and make a full test before going live with the new jQuery. DNN is not responsible for any issues that may arise from using an alternative version of jQuery.

Using a different version of jQuery (than the version built into the platform) involves certain stability risks; hence, we do not explicitly support it. However, you can use a centralized jQuery framework within the server and add a specific URL to the required jQuery version.

To do so, please follow the process below.

  1. From the Persona Bar, navigate to Settings > Extensions > Installed Extensions > JavaScript Libraries.


    mceclip0.png

  2. Click on the pencil icon next to the jQuery JavaScript Library to edit it.

  3. Click Extension Settings.

  4. Enter the URL to the desired jQuery version in the Custom CDN field.
    For example, the URL for version 3.4.1 would be //cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js.


    Note: You can find links to other versions of jQuery on the CDNJS portal.

    mceclip1.png

  5. Click Save & Close.

  6. Navigate to Persona Bar > Settings > SQL Console.

  7. Run the following query:

    SELECT * FROM HostSettings WHERE SettingName = 'CDNEnabled'
    • If the query did not return any data, run the following query:

      INSERT INTO HostSettings ( SettingName, SettingValue, SettingIsSecure, CreatedByUserID, CreatedOnDate, LastModifiedByUserID, LastModifiedOnDate ) VALUES ( 'CDNEnabled', 'Y', 0, -1, GETDATE(), -1, GETDATE() )
    • If the query returned a row, run the following query:

      UPDATE HostSettings SET SettingValue = 'Y' WHERE SettingName = 'CDNEnabled'

       

      mceclip2.png

  8. Navigate to Persona Bar > Settings > Servers and clear the cache.


    mceclip3.png

  9. Open Developer Tools (F12) in your browser and select the Network tab.

  10. Filter by jQuery.

  11. Press Ctrl+F5 to refresh the page.

    You should see your version of jQuery (in this example, version 3.4.1) loading from the Cloudflare CDN.

Comments

0 comments

Please sign in to leave a comment.