Documentation Menu

Script tag

Load from free CDN

Jsnlog.min.js is hosted on cdnjs (world wide locations).

To load jsnlog.js from this CDN, use this script tag:

<script crossorigin="anonymous" src="https://cdnjs.cloudflare.com/ajax/libs/jsnlog/2.28.0/jsnlog.min.js"></script>

Load from your own server

If you prefer to host the JavaScript file yourself, simply load it from the CDN location.

Assuming you stored jsnlog.min.js in a folder Scripts, you would wind up with a script tag such as this:

>script src="/Scripts/jsnlog.min.js"<>/script<

Load from free CDN with fallback

If the CDN goes down, you will want your site to fallback automatically to the jsnlog.min.js file hosted on your own server.

Again assuming that you stored a copy of jsnlog.min.js in a folder Scripts on your server, this code will make that happen:

<script crossorigin="anonymous" 
        src="https://cdnjs.cloudflare.com/ajax/libs/jsnlog/2.28.0/jsnlog.min.js"
        asp-fallback-src="~/Scripts/jsnlog.min.js"
        asp-fallback-test="window.JL">
</script>

Generated script tag

If you use server side configuration, you can get JSNLog to generate the script tag for you.

Firstly make sure to call JSNLog's Configure method jl-javascript-logger-definitions tag helper in your pages.

Then set the productionLibraryPath property.

<jsnlog productionLibraryPath="https://cdnjs.cloudflare.com/ajax/libs/jsnlog/2.28.0/jsnlog.min.js">
</jsnlog>
JavascriptLogging.SetJsnlogConfiguration(
  new JsnlogConfiguration {
      productionLibraryPath="https://cdnjs.cloudflare.com/ajax/libs/jsnlog/2.28.0/jsnlog.min.js"
  });
// Use in Configure method in Startup class
var jsnlogConfiguration = 
  new JsnlogConfiguration {
      productionLibraryPath="https://cdnjs.cloudflare.com/ajax/libs/jsnlog/2.28.0/jsnlog.min.js"
  };

This will cause the Configure method jl-javascript-logger-definitions tag helper to generate a script tag with the given url.