We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Redactor

iframe does not work in redactor enabled textarea

http://dedicated1911.inmotionhosting.com/~barronfi/blog/post.php?s=2014-06-22-building-trust

In the description of the blog post linked above, I have copy-pasted the embed code for a youtube video. The iframe element that should show the video is showing our server's 404 page, saying the server cannot find, dedicated1911.inmotionhosting.com/%22//www.youtube.com/embed/iol0B-clFFM/%22.

Inspecting the iframe element reveals that the quotes around the iframe's attributes are apparently being escaped AND replaced with html entities. The following code is copied directly from chrome's web inspector

<iframe width="\&quot;420\&quot;" height="\&quot;315\&quot;" src="\&quot;//www.youtube.com/embed/iol0B-clFFM\&quot;" frameborder="\&quot;0\&quot;" allowfullscreen="\&quot;\&quot;">
</iframe>

The iframe embed code renders correctly when it is added to the postDescHTML textarea in the backend. I have tried copying the embed code straight into the textarea, into redactor's "code view" and into the textarea that pops up when the "embed video" button is clicked on the redactor toolbar, this did not seem to make a difference.

Here's the post.html template that is displayed on that page, html="true" is set on the postDescHTML template tag.

<div class="hentry">
    <h1>
        <a href="<perch:blog id="postURL" type="hidden" />" rel="bookmark" class="entry-title">
            <perch:blog id="postTitle" type="text" label="Title" required="true" size="xl autowidth" order="1" />
        </a>
    </h1>
    <p class="entry-published date">
        <perch:blog id="postDateTime" type="date" label="Date" time="true" format="F Y" divider-before="Meta information" /> 
        <perch:if exists="authorGivenName">
            by <perch:blog id="authorGivenName" type="hidden" /> <perch:blog id="authorFamilyName" type="hidden" />
        </perch:if>
    </p>
    <perch:if exists="image">
        <div>
            <img src="<perch:blog id="image" type="image" width="827" height="250" crop="true" label="Image" order="4" />" alt="<perch:blog id="postTitle" />" />
        </div>
    </perch:if>
    <div class="description entry-content">
        <perch:if exists="newsl_file"><a href="<perch:blog order="5" id="newsl_file" type="file" label="Newsletter File" />">Download the full Newsletter</a></perch:if>

        <perch:blog id="postDescHTML" type="textarea" label="Post" order="2" editor="redactor" html="true" size="xxl autowidth" required="true" />
    </div>
</div>

<perch:blog id="excerpt" type="textarea" label="Excerpt" textile="true" order="3" suppress="true" size="s" />
<perch:blog id="image" type="image" width="250" height="150" crop="true" suppress="true" />
Evan Dobos

Evan Dobos 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Which version of PHP are you running?

We are running PHP 5.3.28

Edit: phpinfo() says magic_quotes_gpc is on, perhaps that is the problem.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

We've just updated the blog app to fix an issue with legacy PHP and Magic Quotes. Can you update to the latest version and see if that fixes the issue?

Upgrading Perch and the blog app has solved it, thank you!