Issue #1123💬 AnsweredOpened May 21, 2018by alfaalex810 reactions

Onload event inside template

Quick answerby artf

Have you tried with this?

Read full answer below ↓

Question

Hi! I have a problem with some templates. This template has some scripts running after the page is loaded. When this templates is loaded by GrapeJs, the scripts do not starting because browser not detect the ending of load.

It's possibile to load templete in a classic iframe (not injected)?

For example: <iframe src="http://myexamplepages.com" frameborder="0" style="overflow:hidden;height:100%;width:100%" height="100%" width="100%"></iframe>

It is possible to use this solution or you can suggest other one.

Thanks.

Answers (3)

artfMay 24, 2018

Have you tried with this?

const editor = grapesjs.init({
	...
	allowScripts: 1,
});
alfaalex81May 24, 2018

Sure, other scripts with "allowScripts" parameter work fine, but scripts inside "on load event" don't. I inject the code in this way: var newComps = editor.DomComponents; $.get('http://myexamplepages.com', function (e) { newComps.setComponents(e); }); window.editor.setComponents(newComps); Thanks.

artfMay 26, 2018

@alfaalex81 can you provide a live demo of the issue?

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.