Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/web/client/html/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<script nonce="{{ .ScriptNonce }}">
// we really want to load inline styles for youtube embed
window.liteYouTubeNonce = "{{ .StyleNonce }}"
window.scriptNonce = "{{ .ScriptNonce }}"
window.styleNonce = "{{ .StyleNonce }}"
</script>
<div class="page-container">
<div class="page-container-header">
Expand Down
4 changes: 4 additions & 0 deletions cmd/web/client/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ window._hyperscript.browserInit()
// script changes
htmx.config.allowScriptTags = false;

// attempt to fix the problems reported by some users
htmx.config.inlineScriptNonce = window.scriptNonce;
htmx.config.inlineStyleNonce = window.styleNonce;

// Define JSON encoding extension for htmx
htmx.defineExtension('json-enc', {
onEvent: function (name, evt) {
Expand Down