GrapeJS can't load javascript
Question
Hi. I have some script tag in my html code (includes js file and internal javascript tag) But GrapeJS doesn't load any script and apply this.
Can I have any way load javascript to grapejs and export html include javascript code?
Answers (3)
Hi
You can allow script when you init grapesJS instance.
const editor = grapesjs.init({ ... allowScripts: 1, });
Hope that helps you.
@vishal5033 : many thanks for your helps. it works for me.
The script file and internal js will show when export html.
But I see the error message:
and

can you help me?
@phucphanJaneto try to post your code? maybe something is missing or you got the wrong syntax.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #837
[QUESTION] Javascript Deletes
Whenever I import, using import plugin, javascript part of the code is deleted. Is there any way to preserve it? I want to used the exporte...
Issue #1167
[QUESTION] export options
Hi @artf, Are there any other export options than HTML/CSS ? I'm thinking of a way to directly load the configuration from a remote server...
Issue #1059
[Question]: Load html content from a file dynamically
Hi, I need to load content from a html file from server onto editor after or while initializing editor. How this can be implemented? HTML w...
Issue #948
[Question] Grapejs import allow body class
I've imported full html string include head, body tag, and body tag has some classes. When I use editor.getHtml() => I can't get body tag....
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.