I'm using fb customer chat ob my website and trying to basically close the whole chat when a user closes the chat window i managed to make a small code that achieves this.
function hide_facebook() {
var x = document.getElementById("fb-root");
x.style.display = "none";}FB.Event.subscribe('customerchat.dialogHide', hide_facebook());
When i run FB.Event.subscribe('customerchat.dialogHide', hide_facebook());
on the console, the code works and chat hides.
but when i implement the code i get " Uncaught ReferenceError: FB is not defined"
also when i load the sdk myself from
i checked the current sdk bundle and the function is right there i tried adding the code below the customer chat script but nothing seems to work when i try to include the sdk library myself the error disappears but the chat stops working, doesn't even load.
what could be causing this issue?
cause on the console i don't get any more errors so i have no clue.