how to call javascript function in main document from within iframe (ckeditor plugin)
I've built a simple CKeditor 3 plugin with one button that should just call a JS-function when somebody clicks it.
The plugin (code when somebody clicks) looks like this and is working:
var openAssetsBrowser = {
exec:function(editor){
openAssetsBrowser();
}
};
I always get the error "openAssetsBrowser is not a function"
The function itself is somewhere in the page, I thought the order shouldn't开发者_开发技巧 matter since the whole page is read first, before anyone would lclick the ckeditor button that triggers the function
Calling it on a link somewhere (e.g. with jquery) in the page just works:
$("a#linkOpenFileManager").click(function(){
openAssetsBrowser();
return(false);
});
Does anyone know why the function cannot be called from within the CKeditor plugin?
update: when pasting the complete function code instead of "openAssetsBrowser();" in the plugin, all works, but that's not really re-usable code...
now that was easy.
parent.openAssetsBrowser() did the trick!
精彩评论