You are here

function pwa_deliver_js_file in Progressive Web App 7

Deliver the JS for the service worker.

Adds a Service-Worker-Allowed header so that a file served from '/pwa/serviceworker/js' can have a scope of '/'.

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

File

./pwa.pages.inc, line 12

Code

function pwa_deliver_js_file($page_callback_result) {
  drupal_add_http_header('Content-Type', 'application/javascript');
  drupal_add_http_header('Content-Disposition', 'inline; filename="serviceworker.js"');
  drupal_add_http_header('Service-Worker-Allowed', base_path());
  print $page_callback_result;
}