winbox icon indicating copy to clipboard operation
winbox copied to clipboard

Scripts in html content of winbox are ignored

Open nightrider77 opened this issue 1 year ago • 2 comments

I am getting data ( html + script type="text/javascript" inside it) with ajax request. After this, I create window as the following:

new WinBox( { html: data } );

But all JavaScript code, passed within data parameter, is completely ignored. But html shows correctly.

Why?

nightrider77 avatar Apr 15 '24 15:04 nightrider77

It seems to me, .innerHTML doesn't execute scripts inside html. So the only solution is to run scripts inside oncreate event function. This makes switching to this winbox lib very painful...

nightrider77 avatar Apr 15 '24 16:04 nightrider77

Do the scripts need to interact with the parent page? If not you could just use an iframe instead of ajax.

SamMousa avatar Aug 15 '24 08:08 SamMousa