Elderberg Posted December 17, 2019 Report Share Posted December 17, 2019 Hi There,I'm using a Chart Datapage and in the search footer I have the following which i'm testing something weird.<script>document.addEventListener('DataPageReady', function (event) {alert("Hello World");});</script>The hello world executes 3 times upon loading.. Can someone advise i I would be able to limit the execution to run just once? Quote Link to comment Share on other sites More sharing options...
SunakoChan Posted December 18, 2019 Report Share Posted December 18, 2019 Hi @Elderberg, Upon check this with my end it seems that it is working properly, you may check the behavior on this link: https://c0dcv045.caspio.com/dp/aa4a60001bbdd474c93346849048. Try to clear your cache or use other browser and try access it on Deployed DataPage URL. I hope this helps. Quote Link to comment Share on other sites More sharing options...
Hastur Posted December 18, 2019 Report Share Posted December 18, 2019 Hi @Elderberg This is not related to cache or cookies. This is the default behavior of "DataPageReady" event. You need to clean this event after executing. Also, you need to define functions out of event listener to increase the performance. Here is the example of the code: <script> function someFunc() { alert("Hello World"); document.removeEventListener("DataPageReady", someFunc); } document.addEventListener('DataPageReady', someFunc); </script> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.