访问属性的权限被拒绝'filepicker_comm_iframe'
Permission denied to access property 'filepicker_comm_iframe'
当前在我的应用程序中遇到Filepicker的iframe问题。。。我的工具:
- 框架:Rails 4(包括涡轮连杆)
- API:文件选取器.io(JS)
- 文件类型:Coffeescapet
我的样本代码:
ready = ->
filepicker_api_key = $js_data.data('filepickerApiKey')
unprocessed_path = $js_data.data('unprocessedPath')
filepicker.setKey(filepicker_api_key)
$('#image-upload').click (e) ->
picker_options =
services: ['COMPUTER']
mimetypes: ['image/*']
store_options =
location: 's3'
path: unprocessed_path
access: 'public'
filepicker.pickAndStore picker_options, store_options ->
console.log 'foobar'
# alot of code comes here.. which works whenever I refresh the page
$(document).ready(ready)
$(document).on('page:load', ready)
一旦我尝试上传内容,它就会停止。我的日志显示此错误:
错误:访问属性的权限被拒绝'filepicker_comm_iframe'
并且不显示我的'foobar'
日志
但是当我刷新页面时,我没有收到任何错误,并且文件相应地上传。我正在努力避免不得不刷新页面以成功上载。
由于涡轮连杆的机身是重新加载的,我建议在布局文件中移动此代码:
<%= filepicker_js_include_tag %>
从CCD_ 2到CCD_。
它应该可以正常工作(在Rails4中,不需要安装"jquery-turboxlinks"gem)。在未来,我们将研究通用解决方案,独立于此标签的放置位置。
我通过将gem 'jquery-turbolinks'
添加到我的Gemfile(从而运行捆绑包)并将//= jquery.turbolinks
包含到我的application.js中,解决了这个问题。
到目前为止,这是我遇到的唯一有价值的工作。对于这个特定的场景。
加载后,filepicker js将2个iframe添加到body中。当你使用涡轮链接来改变页面时,它们就不见了。所以你需要自己再次添加它们:
if $("#filepicker_comm_iframe").length == 0
$("body").append '<iframe name="filepicker_comm_iframe" id="filepicker_comm_iframe" src="https://dialog.filepicker.io/dialog/comm_iframe/" style="display: none;"></iframe>'
if $("#fpapi_comm_iframe").length == 0
$("body").append '<iframe name="fpapi_comm_iframe" id="fpapi_comm_iframe" src="https://www.filepicker.io/dialog/comm_iframe/" style="display: none;"></iframe>'
相关文章:
- RegEx删除空属性?例如,如果(class=“”||class=“”)移除;否则就下课
- 全局变量和全局对象的属性之间有什么区别吗
- 如果使用 lodash 将属性存在于另一个对象中,则向对象添加属性
- 如何在Bootstrap Modal中为动态点击生成的变量设置jade属性
- 序列化数据属性中对象的最可靠方法
- 分析高度属性时出现意外值{{specs.height}}.index.html
- TypeError:无法读取属性'推'未定义的JavaScript
- 同样,同样的错误'ahorcado.js:26未捕获类型错误:无法读取属性'beginPath'
- AngularJS-使用'true'属性
- 可以't使用JavaScript获取width属性
- 未捕获的TypeError无法读取未定义的属性socialsharing
- 如何使用javascript获取嵌套对象中所有子对象的单个属性
- JavaScript Pub/Sub属性访问问题
- 从JavaScript访问struts操作中的属性
- 是否可以从父类访问子类的属性
- 如何更改reactjs中外部/独立组件的状态或属性
- 如何在选项卡上定义属性'的主窗口对象
- 锚点元素的href属性自动更改
- jQuery最近父级的数据属性选择器
- 用于'魔术串'属性