Inserting youtube video in forum’s post by URL. Youtube BBCode.

Published by Igor Khrupin on

Hello,

Yesterday i needed BBCode which inserting Youtube.com video by URL, not by video ID. I don’t found this 🙂

Here i show you my BBCode.

BBCode usage:

[youtube]{URL}[/youtube]

HTML Replacement:

<script type="text/javascript">
    var s = '{URL}';
    var s2 = s.split("?v=")[1].split("&")[0];
    document.write('<iframe width="425" height="350" src="http://www.youtube.com/embed/' + s2 +'?rel=0" frameborder="0" allowfullscreen></iframe>');
</script>

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.