Blocked by the Content Policy (CSP) after submitting the form

After submitting the form in the browser, only an error message appears stating that the page is blocked due to the content policy.

The error can occur if the form is embedded in the website with an iframe. After submitting, the form mail script is called and then redirected to the thank you page.

What is the Content Policy (CSP)?

CSP stands for “Content Security Policy“. In simple terms, it is a security function that prevents the content of the website from being included from another source. Specifically, it tells the browser from which servers the browser may integrate content.

What does this have to do with my form?

If the form is included in an iframe and the thank you page is displayed in the iframe, the error may occur if the server prevents the form from being included in a frame. You can check if your server implements this security policy at SecurityHeaders.com.

Here the website implements the CSP guideline and also prevents the inclusion of content as an iframe.

Do not open thank you page in the iframe

The easiest way to work around the problem without changing the server configuration itself is not to display the thank you page in the iframe itself.

Leave a Reply

Your email address will not be published. Required fields are marked *