reCAPTCHA with Content Security Policy

前端 未结 3 393
孤街浪徒
孤街浪徒 2020-12-08 21:39

I\'m trying to make reCAPTCHA work along with a strict Content Security Policy. This is the basic version I have, which works correctly:

HTML



        
3条回答
  •  伪装坚强ぢ
    2020-12-08 22:28

    The reCAPTCHA service has been updated so style-src 'unsafe-inline' is not required anymore. Below HTML and HTTP headers should work per this closed issue:

    HTML:

    
    

    HTTP Header:

    Content-Security-Policy: default-src 'self'; script-src 'nonce-{NONCE}'; img-src www.gstatic.com; frame-src www.google.com; object-src 'none'; base-uri 'none';
    

提交回复
热议问题