|Help Centre

Can I make the script wait for specific content?

Last updated at

Our script will normally run automatically onLoad or on DomContentLoaded. If you have specific content that you want to make sure is loaded before our script loads, you can make our script wait for your content. The following example will make the script wait for the variable "globalVariable" to exist and that it's equal to "1":

function tryMe() {
  return typeof(globalVariable) !== 'undefined' && globalVariable == 1;
__fs_conf.push(['setWaitForFunction', tryMe]);

Can't find what you're looking for?