support home

Back to website
Welcome
Login  Sign up

Cookie solution script does not invoke load handlers on scriptsadded by JS

If I have a <script> that I've created via JS and configured with prior consent classes/attributes. Upon consent, the script's load handlers (onload and addEventListener('load') handlers) are never invoked.

And I see why. The activation process "sanitizes" the script, by copying the its attributes over to a brand new <script> element and inserting that. Not sure why...working around some browser weirdness I imagine.

But my load handlers! They're gone.

I have a workaround on my end, but it'd be nice if it were the default behavior.


3 people like this idea
Login or Signup to post a comment