Forum Discussion
Best place to put JavaScript functions for publishing
I'm currently using jsPDF to make dynamic reports, and the current process requires me to edit the story.html file to to add the following lines of code:
- <script src="js/jspdf.debug.js" type="application/javascript"></script>
- <script src="js/createPDF.js" type="application/javascript"></script>
- <script src="js/OpenSans-normal.js" type="module"></script>
Can I use the WebObjects method to load these scripts? If so, could you tell me what it would look like? Any help is appreciated.
- MathNotermans-94 years agoCommunity Member
Out of town momentarily...will help when back home
- BrentWilliam1874 years agoCommunity Member
What I do to include scripts automatically is go to my master slide create an object out of frame and then give a trigger when user clicks to open the file in a new window.
This causes SL to grab that file regardless and add it to the/story_content/external_filesfolder.
Then I just use JS to append the scripts to the head of the html page on the master slide like soconst s = document.createElement(script);s.src = story_content/external_files/[FILENAME].jsdocument.querySelector('head').appendChild(s);
If I have multiple files I will create an array with the files names and loop it instead to save writing redundant code.