PHP Classes

File: examples/example7.php

Recommend this page to a friend!
  Classes of Tom Postma   PHP Content Security Policy generator   examples/example7.php   Download  
File: examples/example7.php
Role: Example script
Content type: text/plain
Description: Example: adding the Content Security Policy META tag.
Class: PHP Content Security Policy generator
Generate CSP headers to prevent security attacks
Author: By
Last change: make notice report-to directive in example7.

Signed-off-by: Tom <>
Date: 5 years ago
Size: 571 bytes


Class file image Download

// Start content output.
?><!DOCTYPE html>
        <meta charset="UTF-8">
        <title>example7 - CSP in meta tag</title>
        <?php echo CSPGenerator::getInstance()->getMetatagContentSecurityPolicy(); ?>
    The Content Security Policy in the META tag can cannot use frame-ancestors, report-uri,
    report-to or sandbox directives and has currently limited browser support. The META tag CSP<br />
    provides weaker security because an injection before the META tag can still change things.<br />