mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-18 15:13:21 +08:00
b40c750965
* Fix broken Turbolinks with CSP nonce [SCI-8583]
10 lines
371 B
JavaScript
10 lines
371 B
JavaScript
document.addEventListener('turbolinks:request-start', function(event) {
|
|
var xhr = event.data.xhr;
|
|
xhr.setRequestHeader('X-Turbolinks-Nonce', $('meta[name="csp-nonce"]').prop('content'));
|
|
});
|
|
|
|
document.addEventListener('turbolinks:before-cache', function() {
|
|
$('script[nonce]').each(function(_index, element) {
|
|
$(element).attr('nonce', element.nonce);
|
|
});
|
|
});
|