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!

Enterprise Security Content Update (ESCU) | New Releases

In November, the Splunk Threat Research Team had one release of new security content via the Enterprise ...

Index This | Divide 100 by half. What do you get?

November 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Stay Connected: Your Guide to December Tech Talks, Office Hours, and Webinars!

❄️ Celebrate the season with our December lineup of Community Office Hours, Tech Talks, and Webinars! ...