Splunk Search

JS Wait page fully loaded

timmalos
Communicator

Hi
I can't find any information on this subject so i ask you 🙂
I work on my application.js and i need to do some css work but only when all searches on my dashboard are finished. Some of them need more than 10 seconds to be fully loaded.

Tried the standard Jquery ready but dosn't work:

$(document).ready(function() {}

For now i use

setTimeout(function(){
    $('.panel_row2_col').before("<div id=monitoring></div>");
}, 20000);

But it's clearly only a workaround.

Thx for any help !

Tags (4)
1 Solution

sideview
SplunkTrust
SplunkTrust

There is an event called "PageReady" which is triggered by the PageStatus object.

I'm not sure to what extent the splunk UI uses this itself - possibly only the old pdfserver app uses it still, but I just tested on 5.0.4 and it does appear to still work.

Essentially PageStatus keeps track not just of the main HTML page load, but also all async processes like flash canvas loading, jobs still being dispatched, running jobs still running, flash canvas still rendering etc.. and it only gives the all clear in the form of that "PageReady" event, when everything has settled down and all jobs are completed.

$(document).bind("PageReady", someFunction);

I would throw an extra couple seconds of setTimeout in there for good measure though, because if it's no longer heavily used in the core product there might be some renders that are no longer being factored into the overall "ready" logic.

View solution in original post

0 Karma

sideview
SplunkTrust
SplunkTrust

There is an event called "PageReady" which is triggered by the PageStatus object.

I'm not sure to what extent the splunk UI uses this itself - possibly only the old pdfserver app uses it still, but I just tested on 5.0.4 and it does appear to still work.

Essentially PageStatus keeps track not just of the main HTML page load, but also all async processes like flash canvas loading, jobs still being dispatched, running jobs still running, flash canvas still rendering etc.. and it only gives the all clear in the form of that "PageReady" event, when everything has settled down and all jobs are completed.

$(document).bind("PageReady", someFunction);

I would throw an extra couple seconds of setTimeout in there for good measure though, because if it's no longer heavily used in the core product there might be some renders that are no longer being factored into the overall "ready" logic.

0 Karma
Get Updates on the Splunk Community!

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...