Skip to content

Instantly share code, notes, and snippets.

@dptole
Created May 21, 2023 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dptole/2556c7d52161a0b785b8321070a11644 to your computer and use it in GitHub Desktop.
Save dptole/2556c7d52161a0b785b8321070a11644 to your computer and use it in GitHub Desktop.
Bypass "This document requires 'TrustedScript' assignment" error
/*
This document requires 'TrustedScript' assignment
https://greasyfork.org/en/scripts/433051-trusted-types-helper
*/
var html = '<p>ok</p>'
trustedTypes.createPolicy('default', {
createHTML: function (string, sink) { return string }
})
var $d = document.createElement('div')
var $d.innerHTML = trustedTypes.defaultPolicy.createHTML(html)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment