<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Loading custom javascript in custom app in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414619#M95500</link>
    <description>&lt;P&gt;Hi @vnravikumar,&lt;/P&gt;

&lt;P&gt;Thank you for your comment. Do you  know a way to achieve this at the home page of the application? So outside of any dashboards?&lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2019 06:49:39 GMT</pubDate>
    <dc:creator>JacobPN</dc:creator>
    <dc:date>2019-03-07T06:49:39Z</dc:date>
    <item>
      <title>Loading custom javascript in custom app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414615#M95496</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I created a custom app from the "sample app" template. I put a application.js file in the appserver/static folder.&lt;BR /&gt;
This file contains: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;console.log("hello")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, when I open the app, the message is not displayed in the console. I have restarted splunk, cleared my browser cache, and used the _bump endpoint. It seems that the javascript just is not getting loaded. What am I missing here? (my Splunk version is 7.2.0)&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 09:24:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414615#M95496</guid>
      <dc:creator>JacobPN</dc:creator>
      <dc:date>2019-03-05T09:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: Loading custom javascript in custom app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414616#M95497</link>
      <description>&lt;P&gt;you js need to wrap inside require call. something like below,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
],
function($,_,mvc){
    console.log("test")
}
)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;then in dashboard form tag you need to include the js file name like below,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form script="youjsfile.js"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sid&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 19:16:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414616#M95497</guid>
      <dc:creator>sdchakraborty</dc:creator>
      <dc:date>2019-03-05T19:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Loading custom javascript in custom app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414617#M95498</link>
      <description>&lt;P&gt;Hi @JacobPN&lt;/P&gt;

&lt;P&gt;It has to work, just cross check whether you had included javascript in your dashboard. The following code works for me. To include advanced js just follow the comment given by @sdchakraborty&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="application.js"&amp;gt;
  &amp;lt;label&amp;gt;sampledashboard&amp;lt;/label&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;application.js&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;PRE&gt;&lt;CODE&gt;console.log("this is to test javascript file");
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Mar 2019 05:01:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414617#M95498</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-03-07T05:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Loading custom javascript in custom app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414618#M95499</link>
      <description>&lt;P&gt;Hi Sid,&lt;/P&gt;

&lt;P&gt;Thanks for the help. Will this work in the home page of the appllcation as well? So not only in dashboards? I'm not sure were to reference the js-file in that case.&lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 06:48:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414618#M95499</guid>
      <dc:creator>JacobPN</dc:creator>
      <dc:date>2019-03-07T06:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: Loading custom javascript in custom app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414619#M95500</link>
      <description>&lt;P&gt;Hi @vnravikumar,&lt;/P&gt;

&lt;P&gt;Thank you for your comment. Do you  know a way to achieve this at the home page of the application? So outside of any dashboards?&lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 06:49:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414619#M95500</guid>
      <dc:creator>JacobPN</dc:creator>
      <dc:date>2019-03-07T06:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Loading custom javascript in custom app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414620#M95501</link>
      <description>&lt;P&gt;Hi Jacob,&lt;/P&gt;

&lt;P&gt;How you developed the application home page? Is it written in html? You can refer ths js in similar way in html page as well, using script tag.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://web.simmons.edu/%7Egrabiner/comm244/weeknine/including-javascript.html"&gt;http://web.simmons.edu/~grabiner/comm244/weeknine/including-javascript.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Sid&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 07:04:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414620#M95501</guid>
      <dc:creator>sdchakraborty</dc:creator>
      <dc:date>2019-03-07T07:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Loading custom javascript in custom app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414621#M95502</link>
      <description>&lt;P&gt;Hi Sid,&lt;/P&gt;

&lt;P&gt;I simply created a new app, from the sample app template. So:&lt;BR /&gt;
"Manage apps" &amp;gt; "Create app"  and then choose the template "sample_app" and click save. &lt;BR /&gt;
Subsequently I placed the mentioned "applications.js" in the appserver/static folder of this app. There is no index.html or anything like that in that folder, where I could place the script tag.&lt;/P&gt;

&lt;P&gt;Jacob&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 07:14:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414621#M95502</guid>
      <dc:creator>JacobPN</dc:creator>
      <dc:date>2019-03-07T07:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Loading custom javascript in custom app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414622#M95503</link>
      <description>&lt;P&gt;Ahh I got it. To see how the java script works you need to create a dashboard in your app. There in the form tag you can add script.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.4/SearchTutorial/Createnewdashboard"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.4/SearchTutorial/Createnewdashboard&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;And please ignore my previous comment as I dont want to confuse you. Follow whatever ma or @vnravikumar  posted yesterday.&lt;/P&gt;

&lt;P&gt;Sid&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 07:19:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414622#M95503</guid>
      <dc:creator>sdchakraborty</dc:creator>
      <dc:date>2019-03-07T07:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Loading custom javascript in custom app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414623#M95504</link>
      <description>&lt;P&gt;I tested it on a dashboard and that works. However, now I want it the work on the app home page. So I want it to log "hello" to the console, on the app homepage. Any ideas?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 07:39:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Loading-custom-javascript-in-custom-app/m-p/414623#M95504</guid>
      <dc:creator>JacobPN</dc:creator>
      <dc:date>2019-03-07T07:39:56Z</dc:date>
    </item>
  </channel>
</rss>

