ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Using YouTube iFrame Embed code - inserted into text input field fails

November 04, 2012 5:19pm

Subscribe [3]
  • #1 / Nov 04, 2012 5:19pm

    Nuvonium

    10 posts

    I’m trying to allow the embedding of youtube (and vimeo) videos. Under the control panel one of my fields is a textarea (default text format = none). When I input the iframe embed code it looks ok.

    But on output and when I return to edit the record the <iframe ...> and </iframe> tags have been converted to their html entitites. They become <iframe…  and </iframe>

    I’m guessing this is because global_xss_filtering is set to true. But how do I “stop” this on this field only. So people can simply input <iframe ...></iframe> video embed code?

     

  • #2 / Nov 05, 2012 4:46am

    why don’t you just use the input field to store the id of the video you want to embed ?

    your output could look like this

    {exp:channel:entries channel="videos"}
    <iframe src="youtube.com/embedcode/{video_id}"></iframe>
    {/exp:channel:entries}

    this way clients shouldn’t have to to bother with HTML. Which will make their and your life easier 😊

  • #3 / Nov 05, 2012 9:29am

    Nuvonium

    10 posts

    A good, viable idea. However, one that’s not totally user friendly. Most users know how to copy YouTube’s embed code. To have them use only the video ID value would require “training”. As simple as it is…I’m sure we’d have to explain it numerous times.

    As it is…we grabbed DevDemon’s channel video. It’s not a perfect solution since we have to instruct them on how to copy the “correct” video URL. But it’s an OK temporary solution.

    I’m hoping for the simplest, uber solution…. some way to simply permit them to copy and paste the embed code.

  • #4 / Nov 06, 2012 10:55am

    Shane Eckert

    7174 posts

    Hey there Nuvonium,

    What version of ExpressionEngine are you running?

    I just tried this with the following code and I have no issues.

    <iframe width="560" height="315" src="http://www.youtube.com/embed/Nl39QcbOkJg" frameborder="0" allowfullscreen></iframe>

    I can edit the entry and nothing changes.

    I am on 2.5.3.

    Cheers,

  • #5 / Nov 06, 2012 11:11am

    Nuvonium

    10 posts

    EE2 v2.5.2 - I guess I’ll update to see if that solves the problem.

    Thanks. I’ll post back with the results.

  • #6 / Nov 07, 2012 11:20am

    Shane Eckert

    7174 posts

    Hey Nuvonium,

    Sounds good. Please let me know how things go.

    Cheers,

  • #7 / Nov 07, 2012 7:12pm

    Nuvonium

    10 posts

    Upgraded to EE2 2.5.3 - using a textarea field, formatting of none, still fails when I input iframe embed code from youtube.

    The embed code gets “cleansed” and iframe tags are converted to html entities.


    Result:
    <iframe width=“560” height=“315” src=“http://www.youtube.com/embed/Kk5scrUVcgI” frameborder=“0” allowfullscreen></iframe>

    <iframe ...  ></iframe>

    Any other ideas?

     

  • #8 / Nov 07, 2012 7:31pm

    Nuvonium

    10 posts

    If under my config.php I disable XSS filtering:

    $config[‘global_xss_filtering’] = FALSE;

    Then the iframe code works.

    But I obviously don’t want to do this…. right?

    So how do I get it to work, even with the XSS filter set to TRUE??

  • #9 / Nov 08, 2012 2:43pm

    Shane Eckert

    7174 posts

    Hi Nuvonium,

    I am still not able to reproduce this. I have XSS filtering on and I can enter your code exactly and I do not get this results.

    Please be on the lookout for an email from EllisLab.

    Cheers,

  • #10 / Nov 08, 2012 3:41pm

    Nuvonium

    10 posts

    Thanks. Received support email. Replied already.

  • #11 / Nov 08, 2012 5:08pm

    Shane Eckert

    7174 posts

    Hi Nuvonium,

    Sounds good!

    Thanks,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases