daattali/shinyjs

Possible to move inline scripts to a .js file for easier CSP implementations?

Open

#274 建立於 2024年10月9日

在 GitHub 查看
 (6 留言) (0 反應) (0 負責人)R (104 fork)batch import
enhancementhelp wanted

倉庫指標

Star
 (521 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Not sure if this is even possible, but I thought it is worth to ask.

When calling shinyjs::useShinyjs, many functions are injected inline in the UI. This is a problem when implementing a strict CSP for a Shiny web application, since inline scripts are blocked by default. Would it be possible that these functions are loaded by calling a script file in the package inst folder instead of injecting them inline? Maybe using a variant of the inject.js script that was previously present in the package, to create the needed calls dynamically?

May be related to #101

On a sidenote: I suspect that the documentation on how to include shinyjs using a HTML template is outdated, since the function inject.js is not included in the package anymore: https://github.com/daattali/shinyjs/blob/0648faa0dc985a5be55bbc745fe042056a0ecfc3/vignettes/shinyjs-usage.Rmd#L167

貢獻者指南