{"id":514,"date":"2025-12-25T18:33:07","date_gmt":"2025-12-25T18:33:07","guid":{"rendered":"https:\/\/xuan.co.uk\/?p=514"},"modified":"2025-12-25T18:40:34","modified_gmt":"2025-12-25T18:40:34","slug":"youtube-booklet-jump-to-a-website-passing-the-current-url-as-a-bookmark","status":"publish","type":"post","link":"https:\/\/xuan.co.uk\/?p=514","title":{"rendered":"Youtube booklet, jump to a website passing the current url as a bookmark"},"content":{"rendered":"<p>Situation, whilst watching a youtube video it will jump to another site and pass the url your on to it.<\/p>\n<p>Make a bookmark, edit the url and replace with this line<\/p>\n<p>javascript:(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span>()<\/span>{<span class=\"hljs-keyword\">var<\/span> scriptUrl=<span class=\"hljs-string\">&#8216;https:\/\/your.website.com\/index.php&#8217;<\/span>;<span class=\"hljs-keyword\">var<\/span> currentUrl=<span class=\"hljs-built_in\">window<\/span>.location.href;<span class=\"hljs-keyword\">if<\/span>(currentUrl.includes(<span class=\"hljs-string\">&#8216;<span style=\"color: #808080;\">youtube.com\/watch?v=<\/span>&#8216;<\/span>)||currentUrl.includes(<span class=\"hljs-string\">&#8216;<span style=\"color: #808080;\">youtu.be\/<\/span>&#8216;<\/span>)){<span class=\"hljs-built_in\">window<\/span>.open(scriptUrl+<span class=\"hljs-string\">&#8216;?url=&#8217;<\/span>+<span class=\"hljs-built_in\">encodeURIComponent<\/span>(currentUrl),<span class=\"hljs-string\">&#8216;_blank&#8217;<\/span>);}<span class=\"hljs-keyword\">else<\/span>{alert(<span class=\"hljs-string\">&#8216;This bookmarklet only works on YouTube video pages.&#8217;<\/span>);}})();<\/p>\n<p>You can edit <span class=\"hljs-string\"><span style=\"color: #808080;\">youtube.com\/watch?v=<\/span> and <span style=\"color: #808080;\">youtube.be\/<\/span> change them to the site you want it to work from, this is for two variants\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Situation, whilst watching a youtube video it will jump to another site and pass the url your on to it. Make a bookmark, edit the url and replace with this line javascript:(function(){var scriptUrl=&#8216;https:\/\/your.website.com\/index.php&#8217;;var currentUrl=window.location.href;if(currentUrl.includes(&#8216;youtube.com\/watch?v=&#8216;)||currentUrl.includes(&#8216;youtu.be\/&#8216;)){window.open(scriptUrl+&#8216;?url=&#8217;+encodeURIComponent(currentUrl),&#8216;_blank&#8217;);}else{alert(&#8216;This bookmarklet only works on YouTube video pages.&#8217;);}})(); You can edit youtube.com\/watch?v= and youtube.be\/ change them to <a class=\"more-link\" href=\"https:\/\/xuan.co.uk\/?p=514\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-514","post","type-post","status-publish","format-standard","hentry","category-tech-tips"],"_links":{"self":[{"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/514","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=514"}],"version-history":[{"count":4,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/514\/revisions"}],"predecessor-version":[{"id":518,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/514\/revisions\/518"}],"wp:attachment":[{"href":"https:\/\/xuan.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xuan.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}