在YouTube上的视频网址附加“&html5 = 1”?(Append “&html5=1” to video URL's on YouTube? (jQuery))

编程入门 行业动态 更新时间:2024-10-27 20:24:17
在YouTube上的视频网址附加“&html5 = 1”?(Append “&html5=1” to video URL's on YouTube? (jQuery))

我无法找到任何关于如何使用Jquery将&html5 = 1附加到搜索/订阅/订阅的视频结果以及所有视频网址的内容。

以下是可能对解决方案有贡献的链接:

示例1: http : //jsfiddle.net/WFd79/

示例2: HTML中的YouTube视频无法正常工作

例3:

function main(){ //Standard Logo document.getElementById('.yt-lockup.yt-lockup-tile a.ux-thumb-wrap').setAttribute('href', 'http://www.youtube.com/feed/subscriptions'); } main();

注意:如果逗号可用于附加到多个ID或类别(如标题和缩略图),则会更加用户友好。 这也不需要嵌入iframe的解决方案。

注2:我使用tampermonkey扩展来注入jquery。

PS我感谢任何试图找到解决方案的人,或者有人也可以从中受益。

I couldn't manage to find anything on how to use Jquery to append &html5=1 to the video results on search/feed/subscriptions and such to all video URL's.

The following are links that MAY contribute to a solution:

Example 1: http://jsfiddle.net/WFd79/

Example 2: YouTube video in HTML not working

Example 3:

function main(){ //Standard Logo document.getElementById('.yt-lockup.yt-lockup-tile a.ux-thumb-wrap').setAttribute('href', 'http://www.youtube.com/feed/subscriptions'); } main();

Note: If commas can be used to append to multiple ID's or classes such as titles plus thumbnails, would be more user friendly. This is also not needing a solution for embeds or iframes.

Note 2: I use tampermonkey extension to inject jquery.

P.S. I thank anyone who attemps to find a solution or has one so others may benefit from this as well.

最满意答案

我不确定这是否是最优雅的方式,但似乎有效:

$(".yt-lockup A.yt-uix-sessionlink").attr("href", function(i, href) { return href + '&html5=1'; });

从:

https://stackoverflow.com/a/2805905/2038928

http://community.sitepoint.com/t/jquery-append-query-string-to-href/6003 使用Jquery将查询字符串附加到URL https://stackoverflow.com/a/6934732/2038928

I am not sure if this is the most elegant way, but it seems to be working:

$(".yt-lockup A.yt-uix-sessionlink").attr("href", function(i, href) { return href + '&html5=1'; });

From:

https://stackoverflow.com/a/2805905/2038928

http://community.sitepoint.com/t/jquery-append-query-string-to-href/6003 Append Query String to URL with Jquery https://stackoverflow.com/a/6934732/2038928

更多推荐

本文发布于:2023-08-01 11:56:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1358119.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:网址   视频   YouTube   URL   jQuery

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!