-
FEATURED COMPONENTS
First time here? Check out the FAQ!
For a window, the scripts are getting added into <head> tag multiple times. How to avoid this multiple script registration into head tag?
zk version: 7.0.8
ZK Fiddle:
https://zkfiddle.org/sample/3ic26d8/2-zul-multiple-header-registration-issue
Steps to reproduce in Zk fiddle:
1. Open
2. Close
3. Open
4. Repeat....
You can see that test.js script has been registered twice in the head section.
The number of times you open the window, the test.js script is registered for those number of times.
Verify it using browser's inspect element. Search for "src="test.js"". You will get the count.
Let me know how to fix this? Any patch releases? Any workarounds for removing them from headers?
Reason for this ask: External paid JS is getting registered multiple times causing the license count to expire very soon as multiple callbacks are registered multiple times.
The known issue, that seems to match your case is ZK-3700 which was fixed in 8.5.0 (3 years ago). For 7.0.8 there's no patch available.
As an alternative, scripts can be loaded and removed in multiple ways. Based on your description it doesn't sound like removing the script and re-loading/re-executing it again will actually solve your license issues. Did you mean to load/execute it only once instead and then keep it in the browser until it's needed next time?
If you already have a custom widget associated with your 3rd party script you can load it from inside the widget package descriptor (.wpd file), which will load a script on demand only once (as used by any zk widget internally) using the <script>-element.
Asked: 2020-09-26 01:37:10 +0800
Seen: 10 times
Last updated: Sep 28 '20