Dashboards & Visualizations

Splunk creates random folder between static and app folders in browser

greggz
Communicator

I'am trying to load a css dynamically in my Javascript. This should be fairly simple, but Splunk's imaginary folder makes it impossible to achieve.

So the path for any file in the static folder becomes: /en-US/static/@c87tfdcn4/app/MyApp/sample.css

How can I find a secure way to get that folder name inside my Javascript ?

Any help is much appreciated, thanks guys

0 Karma
1 Solution

jeffland
SplunkTrust
SplunkTrust

That is splunk caching the file, and the path your browser sees. You can easily access the file with its original path nevertheless, for example by appending it to the head section:

function loadCss(url) {
    var link = document.createElement("link");
    link.type = "text/css";
    link.rel = "stylesheet";
    link.href = url;
    document.getElementsByTagName("head")[0].appendChild(link);
}
loadCss('/static/app/yourApp/yourFile.css');

You could also use requirejs to load the file.

View solution in original post

0 Karma

jeffland
SplunkTrust
SplunkTrust

That is splunk caching the file, and the path your browser sees. You can easily access the file with its original path nevertheless, for example by appending it to the head section:

function loadCss(url) {
    var link = document.createElement("link");
    link.type = "text/css";
    link.rel = "stylesheet";
    link.href = url;
    document.getElementsByTagName("head")[0].appendChild(link);
}
loadCss('/static/app/yourApp/yourFile.css');

You could also use requirejs to load the file.

0 Karma

greggz
Communicator

And here I was just complicating everything. Thanks sir

0 Karma
Get Updates on the Splunk Community!

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

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...