APIs & Integrations

rasoriano
Member

Hidden Chat Widget suddenly appears

So before actually discovering that there's a built-in function to remove/load a widget, we are doing it using a CSS class:

 

 

 

const hubspot = document.getElementById('hubspot-messages-iframe-container');
if (hubspot && role === 'admin') {
    hubspot.classList.add('hide-hubspot');
}

 

 

.hide-hubspot {
  visibility: hidden;
  height: 0 !important;
  width: 0 !important;
  display: none !important;
}

 

We only do this if the authenticated user on our site is an admin. If not or unauthenticated, we remove that class.

 

For some reason, the widget came back and we're not able to reproduce how it happened. I'm thinking it's because there's some code in the hubspot embed script that reloads the widget but not sure when/where does it happen?

 

I am about to open a pull request that replaces our own hide/show class to using the built-in APIs but I'd be happy to know what's the possible cause that let the widget be visible again. Thank you!

0 Upvotes
0 Replies 0

0 Replies

No replies on this post just yet

No one has replied to this post quite yet. Check back soon to see if someone has a solution, or submit your own reply if you know how to help! Karma is real.

Reply to post

Need help replying? Check out our Community Guidelines