I have javascript code that I want to use to open a popup with a button. I’m using the SiteOrigin Button widget. The onclick script works fine in something like this in the Custom HTML widget:
Button
So I know the script is working properly.
Rather than using the Custom HTML widget, I want to use the Button widget so all of the formatting for all buttons on my page and site are the same.
In the Button widget I’m trying to put showPopup() into the onclick field under Other Attributes and SEO. It doesn’t matter what I put into this field, if I save and then reopen the widget, the contents in this field don’t appear. The javascript doesn’t run. Am I using the wrong syntax? Why is this not working?
hmm… the code for the Custom HTML widget got stripped. Trying again:
“”Button””
Sigh..
Hi,
Thanks for reaching out. For security reasons, the onclick field maintains an allowlist of popular services that provide onclick support. In the current release, it’s not possible to add to the allowlist but it will be possible in a future update via a hook called siteorigin_widgets_onclick_allowlist_functions. In the meantime, you’ll need to disable the allowlist to use other functions. This poses a security risk so I don’t recommend doing this. Regardless, that can be done using the following PHP:
Kind regards,
Alex
ok, thanks. I’ll do a workaround.
Thanks for your feedback and understanding.