Skip to main content

I can see that popups can be opened via the `openForm` API [1] but we have a usecase where we want to close the form externally. Is there an api that we can call to close all forms?

Alternatively, can we disable showing of all forms via JavaScript. Our current usecase is that we are embedding our website in a webapp and want to disable showing for forms in that context.


[1] https://developers.klaviyo.com/en/docs/how-to-custom-trigger-a-popup-or-flyout-form

Hello @avinash,

Welcome to the Klaviyo Community!

Interesting use case! Really appreciate you explaining that.

Unlike leveraging the _klOnsite.push or _klOnsite.openForm scripts to open/launch a signup form from a custom trigger, at present, there isn’t any supported functionality for closing a form via the affiliated _klOnsite script. 

I’d be more than happy to share this feedback and use case with our Product Team to explore further!

Thanks for being a part of our Klaviyo Community!

David


Hi,

A closeForm Method is definitely needed to comply with Cookie Consent laws.

When the dialog (Popup FORM) appears before users consent, there’s no easy way to programatically close the dialog and keep it closed until the appropriate Cookie Catagory is Active,

I can detect the opened dialog state using the javascript condition below.

// allowFunctionalCookies = true when C0003 is in dataLayer OnetrustActiveGroups 

if (_klOnsite?._loaded && !allowFunctionalCookies) {
// Close the dialog and keep it closed until C0003 is active
}

Anyone have a solution they’d be willing to share?

Thanks

David


Reply