在舒适中使用特定于布局的javascript会导致InvalidCrossOriginRequest

Using layout specific javascript in comfy leads to InvalidCrossOriginRequest

本文关键字:布局 javascript InvalidCrossOriginRequest 舒适 于布局      更新时间:2023-09-26

我使用Comfy在web应用程序中构建自定义布局。我现在的问题是,当我试图嵌入代码动态加载javascript如下:

<%= javascript_include_tag comfy_cms_render_js_path(@cms_site.id, @cms_layout.identifier) %>

这段代码可以在我的application.html.erb文件中找到。

当我现在用舒适定义的布局加载页面时,我得到这个错误:

ActionController::InvalidCrossOriginRequest (Security warning: an embedded <script> tag on another site requested protected JavaScript. If you know what you're doing, go ahead and disable forgery protection on this action to permit cross-origin JavaScript embedding.)

解决此问题的一种可能性是删除application_controller.rb文件中的protect_from_forgery属性。但这不是一个好的解决方案。

同样的问题发生当我嵌入链接到javascript布局内的管理面板。

我希望你能帮助我。

修复当前master: https://github.com/comfy/comfortable-mexican-sofa/issues/458