Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

113
Views
Allowlist CSP for Javascript code passed in SRC to defer

I want to defer inline Javascript code passed in src and allowlist in CSP (Content-Security-Policy)

For deferring inline JS code, I referred: How to defer inline Javascript?

But I don't see a way to allowlist this in CSP.

Code

<script defer type="text/javascript" src="data:text/javascript,<code>"></script>

If I include data* in script-src directive I receive the violation

The source list for the Content Security Policy directive 'script-src' contains an invalid source: `data*`. It will be ignored.

Another approach I see is to use nonce but this will prevent other scripts from loading which do not have the nonce value.

I understand that there are other ways to defer the script including defining the script in an another local file or hosting it some external location but these two somehow does not work for me, due to other factors. Also I need the script to work globally hence module type will do no good.

Simply put, I want a way to allowlist Javascript code when passed in the SRC field instead of the script content.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!