Deployment Architecture

Setup.xml with inline script or application.js

cresthemal
New Member

Hi,

I want to know which is the best way to write script with setup page. I am aware that application.js will be loaded automatically in the setup page and its the easy way to write some code there, but application.js also get loaded in other places so does this harm what I have written there? I also find that we can write inline script with setup.xml as well. So can some one give brief answer on this what are the pros and cons using application.js over inline script and which is the best way to do write script in setup page?

Thanks in advance.

0 Karma

rjthibod
Champion

According to this question and one of its answers (https://answers.splunk.com/answers/4106/include-jquery-into-setup-xml.html), you may be able to put the JS directly inline via the <script>...</script> tags.

I cannot find any Splunk documentation that mentions another way to load JS files, but you may be able to use a method that is available to HTML dashboards by trying to load a JS file in your app with the following line. I have not tested it, but this is how one includes JS files in HTML dashboards.

<script src="/static/app/<YOUR_APP_NAME>/<JS_FILE_NAME>.js"></script>

0 Karma
Get Updates on the Splunk Community!

Developer Spotlight with Paul Stout

Welcome to our very first developer spotlight release series where we'll feature some awesome Splunk ...

Preparing your Splunk Environment for OpenSSL3

The Splunk platform will transition to OpenSSL version 3 in a future release. Actions are required to prepare ...

Deprecation of Splunk Observability Kubernetes “Classic Navigator” UI starting ...

Access to Splunk Observability Kubernetes “Classic Navigator” UI will no longer be available starting January ...