How use window.onload in UI template

window.onload not work in UI template (header mod or widget)

<script type="text/javascript">
    window.onload = function() {
      console.log("loaded")
                        };
                    
</script>

how use it pls?

I'm fairly sure this came up in another thread recently. I'll give you the same comment. That I believe it is probably due to the fact that the way Dashboard works, the standard ui_template is executed long after that event has fired.

If you want to use it, you will need to load the script in the HEAD section of the page, not the body. I think ui_template has a setting for that.

not work in UI template (header mode or widget)
header mode I meant HEAD section
I tried what you said, but to no avail, so I decided to put it separately

If you remove the function the message appears.

What are you trying to accomplish ?
Note that you can capture dashboard load events with the ui-control node.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.