Does drupal have a problem with iframes in blocks? I say this because I tried to add an amazon search link (which is the form of an iframe) to a new block. The block works fine, but the content on the page disappears when the block is active. Anyone else had a problem with this?

Lunas
www.how-to-box.com

Comments

kbahey’s picture

Google AdSense uses Iframes to display ads.
Many people have them working in blocks without any issues.

What may be happening is that the iframe loads a javascript from another site (Amazon in your case) and somehow, this Javascript conflicts with another piece of js that gets loaded by another contrib module.
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

lunas’s picture

The adsense I have isn't an iframe - it is a piece of javascript I put in the block. It is no problem. I can put an iframe everywhere else, just not in blocks.

bertboerland’s picture

try to see if iframe is allowed html tag or make a new class of tags and allow it there. btw, it is not possible without calling google's api (which cant be done from javascript) to display google adsense without an iframe tag. look in the javascript and you will find an ifram tag i am sure...
--
groets
bertb

--
groets
bert boerland

Steven’s picture

Set the format of the block to full HTML or PHP code to make sure nothing is stripped out.

--
If you have a problem, please search before posting a question.

vfranklyn’s picture

Setting the format of the block to full HTML worked for me. Thanks Steven!

AuntieBirdy’s picture

I know this is an old thread, but the exact same thing happened to me earlier today, because the content disappears on the page you can't administer the block to shut it off... bit of a pita.

This was the only thread I found on this problem, I wanted to share how to fix it incase it happens to someone else.

Anyway this is how you fix it in the event that it happens to someone else.

open block.module
find

      // Use the user's block visibility setting, if necessary
      if ($block['custom'] != 0) {
        if ($user->uid && isset($user->block[$block['module']][$block['delta']])) {
          $enabled = $user->block[$block['module']][$block['delta']];
        }
        else {
          $enabled = ($block['custom'] == 1);
        }
      }
      else {
        $enabled = TRUE;
      }

      // Match path if necessary
 

In the following line temporarily change the 1 to a 0

$enabled = ($block['custom'] == 1);

This will disable all custom blocks

Go into the admin block section disable/delete the offending block. Once it is disabled change the 0 back to a 1

I hope this helps someone