solsol
Posts: 3
Joined: Thu Feb 03, 2011 3:33 pm

EDIT: can't access parent javascript obj from iframs

Hi, I call an expander like so:

Code: Select all

<a href="script.php" onclick="return hs.htmlExpand(this,{objectType:'iframe'})">click here</a>
I use a WYSIWYG Javascript editor (CKEditor / ckeditor.com) and in the expander's parent page I include the javascript for this:

Code: Select all

<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
My problem, is that the editor does not work in the expander - Firebug shows various variables are not defined.

To fix this I need to call the ckeditor.js in script.php which makes the expander slow to open as it has to pull the JS file again, even though the parent window has already done so.

EDIT

End CK editor is called thus in iframe:

Code: Select all

<script type="text/javascript">
CKEDITOR.replace( 'bodytext' ,
{
basePath : '/admin/ckeditor/'
});
</script>
I have tried prefising CKEDITOR with 'parent' , 'parent.window', 'window' all without success

If there any fix for this?

Thank you!
User avatar
RoadRash
Posts: 8249
Joined: Tue Jul 15, 2008 6:43 pm
Location: Fredrikstad, Norway
Contact: Website

Re: EDIT: can't access parent javascript obj from iframs

The parent page and the page opened inside the iframe popup are two different pages, so you need to include the ckeditor.js file in the page opened in the iframe - not in the parent page.
Hilde
Highslide Support Team

Overview of my Highslide sample pages: RoadRash.no

Return to “Highslide JS Usage”