- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2024 06:42 PM
Hi all!
I want to import the JSZip external library by saving its code to a script include.
However, when I tried to run it, an error will appear.
Also, I'm not sure if dependencies exist for the JSZip. Can someone tell me if it exists?
I am grateful if you can help me.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2024 07:43 AM
It might be possible, but JSZip is primarily used client-side. If you use it server-side, you can only use library functions if they don't rely on any browser-specific features.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2024 10:51 PM
Hi @Lhora Alvarez - The error you're encountering ("setTimeout" is not defined) indicates that the JSZip library is attempting to use setTimeout, which is a browser-specific function. This function is not available in ServiceNow's server-side JavaScript environment, which is where Script Includes run. I haven't tried it, but I think--at least theoretically--you would use a UI Script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2024 11:56 PM - edited 08-14-2024 11:57 PM
I see.
Thanks for replying @Sheldon Swift .
Do I understand correctly that we cannot use the JSZip library in ServiceNow's server-side scripts due to its browser-specific functions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2024 07:43 AM
It might be possible, but JSZip is primarily used client-side. If you use it server-side, you can only use library functions if they don't rely on any browser-specific features.