Back

Technologies:

javascriptjavascript
avatar
Tolerim
15 days ago

The iframe that displays the banner with a hyperlink is no longer functioning.

The task I undertook was to set up a banner ad using JavaScript code obtained from this website.

For this purpose, I created a webpage called network-banner-ads.html with an empty div identified as ad-container, which was to be filled with the banner ad using the JavaScript code from network-banner-ads.js.

<!DOCTYPE html>
<html lang="en">
  <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <meta name="description" content="Network Banner Ads">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>Network Banner Ads</title>
    </head>
    <body>
      <div id="ad-container"></div>
      <script src="/network-banner-ads.js" async></script>
    </body>
</html>
Testing the banners on my website was successful. However, when I tried to embed it on another webpage using an IFrame, the banners failed to display, despite having been functioning previously. I included the following code for placement of the IFrame on banners.html.

<html>
  <head>
    <title>Banners</title>
  </head>
  <body>
    <iframe src="https://earthlike1.com/network-banner-ads.html" width="625" height="175" title="Network Banner Ads"></iframe>
  </body>
</html>
Why are the banners not showing up in the IFrame, and how can I make that happen?

Answers(1)
avatar
Tolerim
15 days ago
Verified Answer
There could be multiple reasons why the Iframe is not displaying the banners. One possible reason could be that the src attribute of the Iframe is not pointing to the correct location of the network-banner-ads.html file. To troubleshoot this issue, you can try the following steps: 1. Check if the src attribute of the Iframe is correct and pointing to the network-banner-ads.html file. 2. Verify that the network-banner-ads.js file is included in the correct directory and that the paths to the files are correct. 3. Check if there are any errors in the browser console. 4. Ensure that the website where the Iframe is embedded allows Iframes. Once you have confirmed that the above steps are correct, the Iframe should display the banners. To make the Iframe work on other websites, you can simply copy the banners.html file and the network-banner-ads.html and network-banner-ads.js files to the desired website and update the paths to the files accordingly.
;