Replace youtube tags with iframe tags
3 posters
Page 1 of 1
Replace youtube tags with iframe tags
Hello dear all,
I want a code for my editor that will replace the youtube tags with the iframes tags.
What i mean is:
When i want to add a youtube video in my posts i add it through the youtube icon and it takes the part after the / and adds it in [youtube] tags. Like this:
Now those c7nRTF2SowQ are the key letters for the iframe too. So what i want is a code that will replace
with
and
with
Is there any code that will help me to that?
The alternative way would be a code that will replace the [youtube] tags after the post was sent and change them into the iframe tags i wrote above.
Any of these would be perfect!!
Thanks for your time and much appreciation for those who help!
My forum details:
Forum Link: http://www.thinktankforum.net
Forum Version: Phpbb3
Luffy![:rose:](/users/3412/19/22/63/smiles/2084913611.gif)
I want a code for my editor that will replace the youtube tags with the iframes tags.
What i mean is:
When i want to add a youtube video in my posts i add it through the youtube icon and it takes the part after the / and adds it in [youtube] tags. Like this:
|
Now those c7nRTF2SowQ are the key letters for the iframe too. So what i want is a code that will replace
|
|
|
|
Is there any code that will help me to that?
The alternative way would be a code that will replace the [youtube] tags after the post was sent and change them into the iframe tags i wrote above.
Any of these would be perfect!!
Thanks for your time and much appreciation for those who help!
My forum details:
Forum Link: http://www.thinktankforum.net
Forum Version: Phpbb3
Luffy
![:rose:](/users/3412/19/22/63/smiles/2084913611.gif)
Last edited by Luffy on May 16th 2016, 6:14 pm; edited 1 time in total
Re: Replace youtube tags with iframe tags
@Luffy try installing the following script in all the pages.
- Code:
$(function() {
for (var a = $('embed[src*="youtube"]'), i = 0, j = a.length; i < j; i++) {
a[i].insertAdjacentHTML('beforebegin', '<iframe width="560" height="315" src="' + a[i].src + '" frameborder="0" allowfullscreen></iframe>');
a[i].parentNode.removeChild(a[i]);
}
});
Re: Replace youtube tags with iframe tags
Thank you @Ange Tuteur. That was exactly what i wanted! ![Smile](https://2img.net/i/fa/i/smiles/icon_smile.gif)
![Smile](https://2img.net/i/fa/i/smiles/icon_smile.gif)
![](https://i.servimg.com/u/f18/16/89/96/68/sig_se10.png)
![]() | Forum of the Forums Forumotion Rules | Tips & Tricks | FAQ | Did you forget your password? |
*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
Re: Replace youtube tags with iframe tags
Thanks again for the help Ange. ![Smile](https://2img.net/i/fa/i/smiles/icon_smile.gif)
Topic solved and archived ~ brandon_g
![Smile](https://2img.net/i/fa/i/smiles/icon_smile.gif)
Topic solved and archived ~ brandon_g
![](https://i.servimg.com/u/f18/16/89/96/68/sig_se10.png)
![Replace youtube tags with iframe tags Brando10](https://i.servimg.com/u/f28/11/40/02/06/brando10.png)
Remember to mark your topic
![Replace youtube tags with iframe tags Solved15](https://i.servimg.com/u/f62/17/48/02/71/solved15.png)
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?
![Replace youtube tags with iframe tags Scre1476](https://i.servimg.com/u/f28/11/40/02/06/scre1476.png)
Team Leader
Review Section Rules | Request A Review | Sticker Points
Re: Replace youtube tags with iframe tags
Topic re-opened on topic starter request ~ brandon_g
![](https://i.servimg.com/u/f18/16/89/96/68/sig_se10.png)
![Replace youtube tags with iframe tags Brando10](https://i.servimg.com/u/f28/11/40/02/06/brando10.png)
Remember to mark your topic
![Replace youtube tags with iframe tags Solved15](https://i.servimg.com/u/f62/17/48/02/71/solved15.png)
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?
![Replace youtube tags with iframe tags Scre1476](https://i.servimg.com/u/f28/11/40/02/06/scre1476.png)
Team Leader
Review Section Rules | Request A Review | Sticker Points
Re: Replace youtube tags with iframe tags
Hello and thank you brandon for re-opening the topic,
So the code @Ange Tuteur gave me works fine but it's not actually the one i posted on the first post.
The iframe on the first post has a src of "https://www.youtube.com/embed/Video Url" and the rest.. The code i have now simple changes the simple youtube frame to the iframe with that width. Is there any way we could change it to the actual iframe because when i tried to add the src in the js it showed me an error to the video. I suppose it's the "embed" word in the link (?) because it replaces the embed (?)![Think](/users/3412/19/22/63/smiles/3875570588.gif)
Thanks for your help!![Smile](https://2img.net/i/fa/i/smiles/icon_smile.gif)
So the code @Ange Tuteur gave me works fine but it's not actually the one i posted on the first post.
The iframe on the first post has a src of "https://www.youtube.com/embed/Video Url" and the rest.. The code i have now simple changes the simple youtube frame to the iframe with that width. Is there any way we could change it to the actual iframe because when i tried to add the src in the js it showed me an error to the video. I suppose it's the "embed" word in the link (?) because it replaces the embed (?)
![Think](/users/3412/19/22/63/smiles/3875570588.gif)
Thanks for your help!
![Smile](https://2img.net/i/fa/i/smiles/icon_smile.gif)
![](https://i.servimg.com/u/f18/16/89/96/68/sig_se10.png)
![]() | Forum of the Forums Forumotion Rules | Tips & Tricks | FAQ | Did you forget your password? |
*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
Re: Replace youtube tags with iframe tags
Bump.
![](https://i.servimg.com/u/f18/16/89/96/68/sig_se10.png)
![]() | Forum of the Forums Forumotion Rules | Tips & Tricks | FAQ | Did you forget your password? |
*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
![-](https://2img.net/i/empty.gif)
» light switch for iframe
» iframe using javascript?
» Mobile version in iframe
» Forumotion in Iframe problem.
» Iframe code not work
» iframe using javascript?
» Mobile version in iframe
» Forumotion in Iframe problem.
» Iframe code not work
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum