• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

iframe component communicating with parent html page

Community Beginner ,
May 19, 2017 May 19, 2017

Copy link to clipboard

Copied

Hello,

I am creating an e-learning course and using Adobe Animate for the content (html5 canvas). I have a html webpage (I will call the wrapper) which loads in the content via an iframe. There are times when I would like the animate content to communicate with this wrapper, for example, passing a quiz score result from the content to the wrapper.

Can anyone advise the best way to do this?

Hope this makes sense.

Many thanks.

Views

769

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 19, 2017 May 19, 2017

This came up recently with OAM packages. It think the same might work for iframe. The 'window' variable usually points to the window that the regular HTML is running in. With OAM, and probably iframe, 'window' points to the module not the main window, so that the entity is self contained.

Which means you can talk to window.parent to get at the real window.

Votes

Translate

Translate
LEGEND ,
May 19, 2017 May 19, 2017

Copy link to clipboard

Copied

This came up recently with OAM packages. It think the same might work for iframe. The 'window' variable usually points to the window that the regular HTML is running in. With OAM, and probably iframe, 'window' points to the module not the main window, so that the entity is self contained.

Which means you can talk to window.parent to get at the real window.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 19, 2017 May 19, 2017

Copy link to clipboard

Copied

Hi Colin,

Many thanks for your speedy response, please can I check if this is what you had in mind:

html wrapper: var mainScore;

Animate File: window.parent.mainScore = 10;

I seem to be getting the error message: Uncaught DOMException: Blocked a frame with origin "null" from accessing a cross-origin frame.

I'm not sure if this is the way to go?: Window.postMessage() - Web APIs | MDN

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 19, 2017 May 19, 2017

Copy link to clipboard

Copied

LATEST

If the iframe is coming from another domain, yes, I would expect problems. Don't know the postMessage thing, but it sounds on the right lines.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines