Hello,
I have defined some custom Footer code in the ‘Custom code’ tab of my project Settings in order to show a chat icon on all the website pages.
I would like to disable it for a given page, is it possible to do this somehow in the page settings?
Thanks
Hi @WebflowUser,
Not sure how the chat module is setup but if it is wrapped inside a div
, you could use some custom code to hide that div
if the current url matches a given url. I wrote a little vanilla javascript snipet for you, might help or at least inspire you.
// function definition
function hideChat() {
// get the chat module by selecting its id
const chat = document.getElementById('chat')
// defines page on which the chat should be hidden
const pageToHide = 'mysite.com/nochat.html';
// get current host url
let currentHost = window.location.host; // returns "mysite.com"
/* console.log(currentHost); */
// get current pathname url
let currentPathname = window.location.pathname; // returns "/nochat.html"
/* console.log(currentPathname); */
let currentURL = (currentHost + currentPathname);
/* console.log(currentURL); // returns "mysite.com/nochat.html" */
// if current url equals pageToHide url
if (currentURL == pageToHide) {
// hide chat module
chat.style.display = 'none';
}
};
// call the function
hideChat();
… and here is the codepen for you
EDIT
just change the const pageToHide
to whatever page you wish your chat not to appear.
Hope that helps.
Awesome thank you @anthonysalamin for the time you spent on this!