HTML FAQs

How do I include the JourneyApps iFrame Client in my HTML file?

Please see this section.

Are there any limitations to what kind of websites I can reference as a remote HTML source?

Yes - sources may have restrictions that prevent them from loading in external iFrames. A common example is when cross origin is not supported, as in the case of:

<html src="http://www.google.com" />

What kind of data can I include in the post() method?

You'll be able to include values such as number or strings, or serialized objects.

Posting a complex object (e.g. objects that include promises) or a function will likely throw an error. For such objects you might need to Base64 encode and/or apply JSON.stringify() before passing it in the post(). You will only be able to post function references, not functions themselves.

Can I use the developer console to troubleshooting the iFrame Client?

Yes, by selecting it from the list of available contexts:

Why am I receiving sandboxing errors?

If your HTML content is not loading and you are seeing references to sandboxing issues in the developer console, you are most likely trying to display restricted content.

The JourneyApps iFrame Client currently allows the following:

  • allow-same-origin

  • allow-scripts

  • allow-forms

  • allow-modals

Any other content will result in a sandboxing error.

Note that no additional restrictions are added/lifted on remote HTML sources by JourneyApps. The source may have its own sandboxing restrictions.

I am getting a "Callback for ... is already registered" error when returning to a view that has an HTML component on it. Why?

This happens when a view is already on the viewStack - the html component was registered the first time the view was entered and with the current implementation of the HTML and iFrame Client, you cannot re-register callback for these. You can solve this either by clearing the view from the viewStack before navigating to it, or by manually keeping track (e.g. a global variable in you SharedJS) whether the component was already registered, and not registering it again when returning to the view.

Why am I am getting a "No HTML component matching id: ... found" error upon entering my view?

You will receive this error when you attempt to post() to your iFrame Client before it has loaded successfully. For this you can add a DOMContentLoaded or window.addEventListener('load') event to the iFrame, and post a message back to the app. An example of this is included here.

Last updated