How To Hide Related Videos In YouTube Embeds (2019 Update)

Lượt xem bài viết: 158

Nguồn: Sưu tầm Tác giả: Nguyễn Minh Hoàng

Bài viết ngẫu nhiên

When an embedded YouTube video is done playing, the YouTube player normally shows several related videos, also known as “suggested videos”. However, there are reasons a website owner might want these related videos not to show - due to branding preferences or simply wanting a cleaner user experience.

Before September 2018, a webmaster could disable related videos on YouTube embeds by simply adding ?rel=0 to the iframe’s src like this:

However in September 2018, YouTube changed their embed code so that this rel=0 trick no longer fully disables related videos (instead it makes it so the related videos come from the same YouTube channel as the video displayed). It is no longer possible to fully disable related videos using rel=0.

This option was likely deprecated because it was not seeing a lot of use, but the sudden change has left the rest of us to wonder why rel=0 is not working to hide related videos like it used to. For those of us who still want to be able to embed YouTube videos without related videos showing at the end, there is a snippet of code we can use as a workaround. This is the final result (pay attention at the end of the video):


Viết gì đó

Có 0 bình luận