You are here

function pwa_deliver_manifest_file in Progressive Web App 7.2

Set the correct mime type for manifest file.

1 string reference to 'pwa_deliver_manifest_file'
pwa_menu in ./pwa.module
Implements hook_menu().

File

./pwa.module, line 619

Code

function pwa_deliver_manifest_file($page_callback_result) {
  if (_pwa_check_page_callback_result($page_callback_result)) {
    drupal_add_http_header('Content-Type', 'application/manifest+json');
    drupal_add_http_header('Content-Disposition', 'inline; filename="manifest.webmanifest"');

    // Allow caching of manifest file for a week.
    drupal_add_http_header('Cache-Control', 'max-age=604800');
    print json_encode($page_callback_result, JSON_PRETTY_PRINT | JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
  }
}