Archive

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.

View solution in original post

0 Karma
Take the 2021 Splunk Career Survey

Help us learn about how Splunk has
impacted your career by taking the 2021 Splunk Career Survey.

Earn $50 in Amazon cash!