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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...