diff -Naur /var/www/html/secure-ogp-old/sites/all/modules/fb/fb.module sites/all/modules/fb/fb.module
--- /var/www/html/secure-ogp-old/sites/all/modules/fb/fb.module	2018-06-07 20:20:20.400053000 +0530
+++ sites/all/modules/fb/fb.module	2018-06-07 21:09:04.506625862 +0530
@@ -857,36 +857,46 @@
 
   $settings = fb_js_settings();
 
+/*
   $output .= "<script type=\"text/javascript\">\n";
   $output .= "<!--//--><![CDATA[//><!--\n";
-
+*/
+  $inline_js = '';
   // Pending javascript that needs to execute after FB is initialized.
   $js_array = fb_invoke(FB_OP_JS, array('fb' => $GLOBALS['_fb'], 'fb_app' => $GLOBALS['_fb_app']), array());
   if (count($js_array)) {
     // The function we define in the footer will be called after FB is initialized.
-    $output .= "FB_JS.initHandler = function() {\n";
+    $inline_js .= "FB_JS.initHandler = function() {\n";
     //$output .= "debugger;\n";
-    $output .= implode("\n  ", $js_array);
-    $output .= "};\n";
-    $output .= "jQuery(document).bind('fb_init', FB_JS.initHandler);\n\n";
+    $inline_js .= implode("\n  ", $js_array);
+    $inline_js .= "};\n";
+    $inline_js .= "jQuery(document).bind('fb_init', FB_JS.initHandler);\n\n";
   }
 
   // Our settings.  We add them here, as late during request as possible.
-  $output .= "  jQuery.extend(Drupal.settings, " . json_encode(array('fb' => fb_js_settings())) . ");\n\n";
+  $inline_js .= "  jQuery.extend(Drupal.settings, " . json_encode(array('fb' => fb_js_settings())) . ");\n\n";
 
   // Initialize FB.
-  $output .= "if (typeof(FB) == 'undefined') {\n";
+  $inline_js .= "if (typeof(FB) == 'undefined') {\n";
   // Load the JS SDK asynchronously.
   // http://developers.facebook.com/docs/reference/javascript/
-  $output .= "  var e = document.createElement('script');\n";
-  $output .= "  e.async = true;\n";
-  $output .= "  e.src = Drupal.settings.fb.js_sdk_url;\n";
-  $output .= "  document.getElementById('fb-root').appendChild(e);\n";
-  $output .= "}\n\n";
+  $inline_js .= "  var e = document.createElement('script');\n";
+  $inline_js .= "  e.async = true;\n";
+  $inline_js .= "  e.src = Drupal.settings.fb.js_sdk_url;\n";
+  $inline_js .= "  document.getElementById('fb-root').appendChild(e);\n";
+  $inline_js .= "}\n\n";
+/*
 
   $output .= "\n//--><!]]>\n";
   $output .= "\n</script>\n";
 
+  */
+  drupal_add_js('jQuery(document).ready(function () { '.$inline_js.' });', array(
+    'type' => 'inline',
+    'scope' => 'footer',
+    'weight' => 15,
+  ));
+
   $page['page_bottom']['fb'] = array(
     '#type' => 'markup',
     '#markup' => $output,
