How to trigger / launch a colorbox programatically? I would like to launch a colorbox right after an user has successfully saved a new node.

The content of the colorbox is a drupal block which would contain instructions asking the user to share that newly created node to their social media.

I am able to set up a link which loads the block into the colorbox when the link is clicked.

I would like, however, to programatically call the "link clicking" event. So, how do I trigger, by JQuery or otherwise, a colorbox from my custom form submit handler?
Install colorbox module. Read its README.txt to find out how to build links for loading inline and iframe content in a colorbox.

Set the id #cbox_trigger_on_page_load for your link and place it somewhere in your page and hide it with CSS.

If you are loading inline content, place the content in a block and hide the block too with CSS.

The mechanics of how to place the hidden colorbox link on the right page is not really what the question is about, is it?

So, lets stick with how to trigger the colorbox.

/**
 * Implements hook_preprocess_html();
 */
function MYMODULE_preprocess_html(&amp;$variables) {
  // The overlay content from the site in an iframe should have cbox_overlay
  // as first path argument.
  // i.e. http:/mywebsite.com/cbox_overlay/content-title.

  // This will prevent a triggering loop.
  $is_cbox_overlay = FALSE;
  if (arg(0) == 'cbox_overlay') {
    $is_cbox_overlay = TRUE;
  }

  $settings = array(
    'is_cbox_overlay' =&gt; $is_cbox_overlay,
  );
  drupal_add_js(array('MYMODULE' =&gt; $settings), array('type' =&gt; 'setting'));

  drupal_add_js(drupal_get_path('module', 'MYMODULE') . '/js/colorbox_onpageload.js', array( 
    // Making sure our JQuery code runs after colorbox's.
    'scope' =&gt; 'footer', 
    'weight' =&gt; '15' 
  ));
}


In the /js/colorbox_onpageload.js file:

(function ($) {  
  Drupal.behaviors.MYMODULE = {
    attach: function (context, settings) {            
      if (!settings.MYMODULE.is_cbox_overlay &amp;&amp; $('#cbox_trigger_on_page_load').length) {
        $('#cbox_trigger_on_page_load')[0].click();
      }
    }

};})(jQuery);