ckeditor 插件开发,dialog里的iframe怎么刷新

我在开发ckeditor插件的时候,在dialog里插入一个iframe,点击toolbar上的按钮打开dialog没问题,但是第二次打开的时候显示的dialog里的iframe里的页面还是上次打开时的样子,无法刷新。

CKEDITOR.dialog.add("QGLImageDialog", function(editor){
 var timestamp = Math.round(new Date().getTime()/1000);
 var ckeditorPage = '/image/ckeditor?timestamp=' + timestamp;
 return {
     title: '上传图片',
     minWidth: 800,
     minHeight: 400,
     contents:
     [
         {
             id: "upload",
             label: "上传图片",
             padding: 0,
             elements: [
                 {
                     type: "html",
                     html: "<iframe id='swfuploadPage' width='100%' height='100%' src='" + ckeditorPage + "'></iframe>",
                     style: "width:100%;height:380px;padding:0;"
                 }
             ]
         }
     ],
     onLoad:function(){
     },
     onShow:function(){
     },
     onCancel:function(){
     },
     resizable: CKEDITOR.DIALOG_RESIZE_HEIGHT
 }

});

有什么办法可以在onShow里刷新contents里的内容?

阅读 7.3k
1 个回答

自己找到解决办法了,就是直接在onShow,或者在onHide方法里根据id获取iframe然后刷新

onHide:function(){document.getElementById('swfuploadPage').contentDocument.location.reload();}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题