Hi there,
I have a custom third party code that I want to be placed at the end of a specific page. This code is a Java Script code that is output as an iframe. This prevents me from placing this code in the HTML iframe element of WIX. So I placed the code in the dashboard in the “custom code” section in “body end” and selected a specific page at “applied to”. Unfortunately, once the code is loaded, it is also displayed on all the other pages. I tried to hide it on certain pages with the following code, but it didn’t work. Unfortunately, I’m not very familiar with Java Script and therefore don’t know where the error is or what else I’m doing wrong.
window.onload = function () {
var url = window.location.href;
if (url === "URL of specific page") {
var iframes = document.querySelectorAll('.newsletter-reguest iframe');
for (var i = 0; i < iframes.length; i++) {
iframes[i].style.display = 'none';
}
}
};
Product:
I am using. WIX Editor - Custom Code
What are you trying to achieve:
I want the code to be displayed on only one specific page.
What have you already tried:
I tried several options with css and javascript, but since I don’t know a lot about javascript it could have simply be wrong.
Additional information: