How to remove a header and footer from a Google Drive document?

AFAIK the Google Document UI does not include a menu to remove the header / footer, but this could be done by using Google Apps Script.


The following script deletes the document header

removeHeader () {function
var doc = DocumentApp.getActiveDocument ();
doc.getHeader (). removeFromParent ();