In hook_boot jQuery is undefined I am doing some processing in hook_boot since I need that code to run on every page, irrespective of whether or not they are cached.

As a result, jQuery is undefined when I add inline JavaScript to the page.

function hook_boot() {
  drupal_add_js("jQuery('document').ready(function() { //do });");
}


The idea is that we will potentially load a lightbox on every page after processing in hook_boot. 

The only way I can see round this is using variable_set and then retrieving that in another hook (e.g hook_node_*). However, that might not be sufficient since we need it to run on every page.

How would you get round this?
If you add the JavaScript in hook_init, then it will be there the next time the page is served from the cache.

And if the page is served from the cache, then calling drupal_add_js in hook_boot will not add JavaScript to the page, because the page is not assembled from calling the page callback, but is served from the cache.

Use hook_init instead of hook_boot.