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
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
Last edited by Luffy on Mon May 16, 2016 5: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!
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.
Topic solved and archived ~ brandon_g
Topic solved and archived ~ brandon_g
Remember to mark your topic when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?
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
Remember to mark your topic when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?
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 "http://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 (?)
Thanks for your help!
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 "http://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 (?)
Thanks for your help!
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.
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!
Similar topics
» Issue with iframe and googlemaps
» Mobile version in iframe
» iframe using javascript?
» Iframe code not work
» light switch for iframe
» Mobile version in iframe
» iframe using javascript?
» Iframe code not work
» light switch for iframe
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum