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 ...

State of Splunk Careers 2024: Maximizing Career Outcomes and the Continued Value of ...

For the past four years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...

Data-Driven Success: Splunk & Financial Services

Splunk streamlines the process of extracting insights from large volumes of data. In this fast-paced world, ...