This guide covers two methods for loading multiple external JavaScript files into Netsapiens portal.
This method leverages how Netsapiens processes UI config values by injecting multiple script tags through a single configuration entry.
Netsapiens takes the UI config value and renders it as a <script> tag in the page. By carefully formatting the value, you can inject multiple script tags at once.
In your UI config, enter the following value (replace URLs with your actual script URLs):
YOUR_FLOWBOT_JS_URL"></script><script src="ANY_OTHER_JS_URL
The above configuration will be rendered in the HTML as:
<script src="FLOWBOT_JS_URL"></script>
<script src="ANY_OTHER_JS_URL"></script>

While this method works for loading multiple scripts, the configuration becomes increasingly difficult to manage and maintain as you add more files. The string quickly becomes monstrous and error-prone with many nested script tags. For loading more than 2-3 scripts, consider using Method 2 instead.
This method involves loading external scripts dynamically from within another script that's already included in Netsapiens Portal page.
Add the following JavaScript code to a script that's already loaded in Netsapiens:
(function() {
'use strict';
const FLOWBOT_SCRIPT_URL = 'YOUR_FLOWBOT_JS_URL_HERE';
function loadFlowbot() {
const script = document.createElement('script');
script.src = FLOWBOT_SCRIPT_URL;
script.async = true;
script.onload = function() {
console.log('Flowbot widget loaded successfully');
};
script.onerror = function() {
console.error('Failed to load Flowbot widget from:', FLOWBOT_SCRIPT_URL);
};
document.head.appendChild(script);
}
function init() {
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', loadFlowbot);
} else {
loadFlowbot();
}
}
init();
})();

Content Security Policy (CSP) may block dynamically loaded scripts if the Netsapiens portal has strict CSP headers configured. If you encounter issues with scripts not loading:
script-src directive| Feature | Method 1: UI Config | Method 2: Dynamic Loading |
|---|---|---|
| Ease of Setup | ✅ Very Easy | ⚠️ Moderate |
| Multiple Scripts | ✅ Yes | ✅ Yes |
| Error Handling | ❌ No | ✅ Yes |
| Conditional Loading | ❌ No | ✅ Yes |
| CSP sensitive | ✅ No | ❌ Yes |
| Code Required | ✅ No | ❌Yes |
| Multi-file Support | ❌ Poor | ✅ Excellent |