Page 1 of 1

How to insert a custom script?

Posted: Wed Jan 11, 2023 3:11 pm
by rganguly
Hi,

How to insert a custom script in the file? I am using HTML > before </body> but it generates an error because my script starts with a <script> tag and after generating the project this script embeds into index.js and generates an error for the script tag used by me.

Please help ...
Thanks.

Re: How to insert a custom script?

Posted: Wed Jan 11, 2023 3:16 pm
by Pablo
Where you need to insert the script depends on the script itself.
Without knowing how the script works, it is not possible to say anything meaningful about this.

Re: How to insert a custom script?

Posted: Wed Jan 11, 2023 3:19 pm
by rganguly
Pablo wrote: Wed Jan 11, 2023 3:16 pm Where you need to insert the script depends on the script itself.
Without knowing how the script works, it is not possible to say anything meaningful about this.
The script is for Jornaya, and as per them, this script should be inserted before closing the body tag.

Re: How to insert a custom script?

Posted: Wed Jan 11, 2023 3:20 pm
by rganguly
When I try to add before </body> tag using page HTML, it generates this error: " Uncaught SyntaxError: Unexpected token '<' " because of the script tag

Re: How to insert a custom script?

Posted: Wed Jan 11, 2023 3:23 pm
by rganguly

Re: How to insert a custom script?

Posted: Wed Jan 11, 2023 3:38 pm
by rganguly
Please help ...

Re: How to insert a custom script?

Posted: Wed Jan 11, 2023 4:19 pm
by crispy68
Are you sure you are entering the script correctly into WB?

I don't believe a <script> tag should not be in a separate .js file like your image. The <script> tag should only be in the html portion referencing the function in your .js file.

What does the original script look like that you are inserting?

Re: How to insert a custom script?

Posted: Wed Jan 11, 2023 6:46 pm
by Pablo
You can control the HTML/Javascript output in Tools -> Options -> HTML
If you do not want the code to be placed in an external js file then uncheck 'Generate external JS file'

Note that we cannot give support on third party code. But if you leave all HTML output on their default then the code will be inserted "AS IS".