<?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: Splunk embed HTML (ServerSideInclude) in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71416#M3861</link>
    <description>&lt;P&gt;Yeah there script errors, I'm not at work at the moment so can't check the specific errors. The map view does not load up when testing on IE7/8&lt;/P&gt;</description>
    <pubDate>Sun, 17 Jun 2012 16:05:26 GMT</pubDate>
    <dc:creator>MHibbin</dc:creator>
    <dc:date>2012-06-17T16:05:26Z</dc:date>
    <item>
      <title>Splunk embed HTML (ServerSideInclude)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71408#M3853</link>
      <description>&lt;P&gt;All,&lt;/P&gt;

&lt;P&gt;I'm trying to include a HTML file in my advanced view, but all I get is the "div" element... The HTML should query an online API through javascript, which works fine outside of Splunk, but the moment I try to include the HTML file in Splunk I see the "div" - as in it hasn't worked correctly.&lt;/P&gt;

&lt;P&gt;The javascript has a main function "initialise()", which I call with a "&lt;CODE&gt;\&amp;lt;body onload="initialize()"\&amp;gt;&lt;/CODE&gt;" in the HTML and works, but when I try to call this in Splunk it does not.&lt;/P&gt;

&lt;P&gt;I'm point Splunk to the following HTML file..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;

&amp;lt;head&amp;gt;

&amp;lt;script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;script type="text/javascript" src="locations.js"&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;script type="text/javascript" src="maps.js"&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;/head&amp;gt;

&amp;lt;body onload="initialize()"&amp;gt;

&amp;lt;div id="map_canvas" style="width: 1200px; height: 700px;"&amp;gt;map div&amp;lt;/div&amp;gt;

&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And using the following XML file:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;view template="dashboard.html"&amp;gt;
  &amp;lt;label&amp;gt;My Dashboard&amp;lt;/label&amp;gt;
  &amp;lt;module name="AccountBar" layoutPanel="appHeader"/&amp;gt;
  &amp;lt;module name="AppBar" layoutPanel="navigationHeader"/&amp;gt;
  &amp;lt;module name="Message" layoutPanel="messaging"&amp;gt;
    &amp;lt;param name="filter"&amp;gt;*&amp;lt;/param&amp;gt;
    &amp;lt;param name="clearOnJobDispatch"&amp;gt;False&amp;lt;/param&amp;gt;
    &amp;lt;param name="maxSize"&amp;gt;1&amp;lt;/param&amp;gt;
  &amp;lt;/module&amp;gt;
  &amp;lt;module name="ServerSideInclude" layoutPanel="panel_row1_col1"&amp;gt;
    &amp;lt;param name="src"&amp;gt;testMap1.html&amp;lt;/param&amp;gt;
  &amp;lt;/module&amp;gt;
&amp;lt;/view&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any advice on what I'm doing wrong, it's just a simple view to display a map (yes I know there is an App for this, which is great, just not for my use-case &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; ).&lt;/P&gt;

&lt;P&gt;Thanks in advance,&lt;/P&gt;

&lt;P&gt;MHibbin&lt;/P&gt;

&lt;P&gt;EDIT - including javascript...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  var centerPoint = new google.maps.LatLng(9.449062,7.950439);
  var marker;
  var map;
  var i;

  var locations = [
     [9.449062, 7.950439, 0],
     [34.449062, 10.950439, 50]
  ];

  function initialize() {
      var mapOptions = {
        zoom: 2,
        mapTypeId: google.maps.MapTypeId.HYBRID,
        center: centerPoint
      };

      map = new google.maps.Map(document.getElementById("map_canvas"),
              mapOptions);


      for (i = 0; i &amp;lt; locations.length; i++) {
          marker = new google.maps.Marker({
            map:map,
            draggable: false,
            animation: google.maps.Animation.DROP,
            position: new google.maps.LatLng(locations[i][0], locations[i][1]),
          });
          google.maps.event.addListener(marker, 'click', toggleBounce);
      }
  }

// for toggleBounce, need to add ", toggleBounce" back into previous brackets.

  function toggleBounce() {

      if (marker.getAnimation() != null) {
        marker.setAnimation(null);
      } else {
      marker.setAnimation(google.maps.Animation.BOUNCE);
      }

  }
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Jun 2012 18:36:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71408#M3853</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-06-10T18:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk embed HTML (ServerSideInclude)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71409#M3854</link>
      <description>&lt;P&gt;I should note that I have also tried embedding the JS straight into the HTML file (with and without CDATA), but neither seems to work.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jun 2012 18:36:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71409#M3854</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-06-10T18:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk embed HTML (ServerSideInclude)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71410#M3855</link>
      <description>&lt;P&gt;When using the ServerSideInclude module you should prepare the file to only contain the fragment that should be placed in the dashboard panel. Additionally when including assets (like JS files) should rather use a server-relative url. Here's a little example that should work:&lt;/P&gt;

&lt;P&gt;testMap1.html:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;div id="map_canvas" style="width: 1200px; height: 700px;"&amp;gt;map div&amp;lt;/div&amp;gt;
&amp;lt;script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript" src="/static/app/myapp/locations.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript" src="/static/app/myapp/maps.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript"&amp;gt;
    $(initialize); // will call intialize on DOM-ready, like &amp;lt;body onload="..."&amp;gt;
&amp;lt;/script&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(You'd have to replace the app-name (myapp) in the script source URL)&lt;/P&gt;

&lt;P&gt;Additionally the IframeInclude module might also suit your needs. &lt;/P&gt;</description>
      <pubDate>Sun, 10 Jun 2012 19:19:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71410#M3855</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-06-10T19:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk embed HTML (ServerSideInclude)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71411#M3856</link>
      <description>&lt;P&gt;Hi Ziegfried,&lt;/P&gt;

&lt;P&gt;That's great! I assume that because Splunk does not use the "body" tag that I "onload"ing. I'm still learning my JS, didn't know about the "$(.." bit. Is there a name for this usage, so I look it up?&lt;/P&gt;

&lt;P&gt;Thanks for the help (once again &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ).&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;MHibbin&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jun 2012 19:40:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71411#M3856</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-06-10T19:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk embed HTML (ServerSideInclude)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71412#M3857</link>
      <description>&lt;P&gt;Yes, the template engine extracts the content of the body tag. The $-function is jQuery. You can use it because it's included by Splunk by default. Here's a link to the relevant API docs: &lt;A href="http://api.jquery.com/jQuery/#jQuery3"&gt;http://api.jquery.com/jQuery/#jQuery3&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jun 2012 19:42:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71412#M3857</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-06-10T19:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk embed HTML (ServerSideInclude)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71413#M3858</link>
      <description>&lt;P&gt;ah right, I see. Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jun 2012 19:47:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71413#M3858</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-06-10T19:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk embed HTML (ServerSideInclude)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71414#M3859</link>
      <description>&lt;P&gt;@ziegfried,&lt;/P&gt;

&lt;P&gt;Just have another question, it looks like there are some restrictions on the scripts being run on IE 7/8, are there things you may know of that will stop this? - someone mentioned it could be the use of JQuery.&lt;/P&gt;

&lt;P&gt;Is there a way around this at all?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jun 2012 15:42:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71414#M3859</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-06-17T15:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk embed HTML (ServerSideInclude)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71415#M3860</link>
      <description>&lt;P&gt;Are getting any script errors in IE or how can you tell there are restrictions? Jquery runs fine in IE...&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jun 2012 15:47:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71415#M3860</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-06-17T15:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk embed HTML (ServerSideInclude)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71416#M3861</link>
      <description>&lt;P&gt;Yeah there script errors, I'm not at work at the moment so can't check the specific errors. The map view does not load up when testing on IE7/8&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jun 2012 16:05:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71416#M3861</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-06-17T16:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk embed HTML (ServerSideInclude)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71417#M3862</link>
      <description>&lt;P&gt;Could be a simple syntax error. Let me know when you know which errors show up.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jun 2012 16:08:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71417#M3862</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-06-17T16:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk embed HTML (ServerSideInclude)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71418#M3863</link>
      <description>&lt;P&gt;OK I will do. I have updated the question with my javascript.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jun 2012 16:23:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71418#M3863</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-06-17T16:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk embed HTML (ServerSideInclude)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71419#M3864</link>
      <description>&lt;P&gt;Alright, Syntax error is in the constructor call of the &lt;CODE&gt;google.maps.Marker({...})&lt;/CODE&gt;. The javascript object ends with an trailing comma, this isn't allowed. Most browsers tolerate that, but IE doesn't.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;      marker = new google.maps.Marker({
        map:map,
        draggable: false,
        animation: google.maps.Animation.DROP,
        position: new google.maps.LatLng(locations[i][0], locations[i][1]), // &amp;lt;--
      });
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 17 Jun 2012 16:27:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71419#M3864</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-06-17T16:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk embed HTML (ServerSideInclude)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71420#M3865</link>
      <description>&lt;P&gt;OK, thanks I will try this tomorrow when I'm in the office and check.&lt;/P&gt;

&lt;P&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jun 2012 16:28:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Splunk-embed-HTML-ServerSideInclude/m-p/71420#M3865</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-06-17T16:28:59Z</dc:date>
    </item>
  </channel>
</rss>

