Custom Code in "body end" only visible on one page

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:

This should normaly be your solution.

  1. Navigating to Dashborad-Settings → adding your CUSTOM-CODE.
  2. Selecting → HEAD or BODY
  3. Selecting → All pages or a specific one.

Check your settings one more time.

Sadly it isn’t.


Here is the code snippet that is supposed to be applied to a specific page.

Sadly I can’t post a link to the site.

The following is part of the problem:
The link would have shown the bottom of the start page, where you can see a form for the registration for a newsletter (this is the element I want only on this specific page).
But if you then go to one of the other pages it appears at the bottom of those sites as well.
If you refresh another page then the form is not there and only visible on the start page.

I am out of ideas of how I can solve this problem.