How to Use Offline Scripts and Styles Instead of CDN Links in Bold Reports
Bold Reports provides the option to use local (offline) client scripts and stylesheets instead of Content Delivery Network (CDN) links. Using offline assets allows your application to function reliably in restricted intranet environments, isolated virtual networks, or environments without internet access. Follow the steps below to configure offline scripts in your application.
Step 1: Download the Matching Offline Package
- Navigate to NuGet to access the client assets package:
- In the Versions tab, select the version that matches your project’s Bold Reports backend package version.
- Click Download package on the right-hand panel to save the
.nupkgfile locally. - Rename the downloaded file extension from
.nupkgto.zip(e.g.,boldreports.javascript.x.x.x.zip). - Extract the
.ziparchive to a local folder.
Step 2: Add Scripts and Styles to the Application
-
Open the extracted folder and locate the
ContentandScriptsdirectories. -
Copy these folders and paste them into your project’s static assets location and place them inside the
wwwrootfolder (e.g.,wwwroot/Contentandwwwroot/Scripts).
Step 3: Replace CDN Links with Local References
Open the _Layout.cshtml file or the page where Bold Reports resources are referenced. Locate the existing Bold Reports CDN references and replace them with the corresponding local file references from the Content and Scripts folders.
Before (Using External CDN Links):
<head>
<!-- Report Viewer component style -->
<link href="https://cdn.boldreports.com/15.1.11/content/v2.0/tailwind-light/bold.report-viewer.min.css" rel="stylesheet" />
<!-- Report Viewer component dependent scripts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdn.boldreports.com/15.1.11/scripts/v2.0/common/bold.reports.common.min.js"></script>
<script src="https://cdn.boldreports.com/15.1.11/scripts/v2.0/common/bold.reports.widgets.min.js"></script>
<!-- Report Viewer component script -->
<script src="https://cdn.boldreports.com/15.1.11/scripts/v2.0/bold.report-viewer.min.js"></script>
</head>
After (Using Local Offline Assets):
<head>
<!-- Report Viewer component style -->
<link href="~/content/bold-reports/v2.0/tailwind-light/bold.report-viewer.min.css" rel="stylesheet" />
<!-- Report Viewer component dependent scripts -->
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/scripts/bold-reports/v2.0/common/bold.reports.common.min.js"></script>
<script src="~/scripts/bold-reports/v2.0/common/bold.reports.widgets.min.js"></script>
<!-- Report Viewer component script -->
<script src="~/scripts/bold-reports/v2.0/bold.report-viewer.min.js"></script>
</head>
Note: Bold Reports periodically releases updates, enhancements, and bug fixes. To benefit from these improvements, update the offline scripts whenever you upgrade your Bold Reports version.