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=‘https://your.website.com/index.php’;var currentUrl=window.location.href;if(currentUrl.includes(‘youtube.com/watch?v=‘)||currentUrl.includes(‘youtu.be/‘)){window.open(scriptUrl+‘?url=’+encodeURIComponent(currentUrl),‘_blank’);}else{alert(‘This bookmarklet only works on YouTube video pages.’);}})();
You can edit youtube.com/watch?v= and youtube.be/ change them to the site you want it to work from, this is for two variants
Posted on December 25, 2025, 6:33 pm By xuan
Categories: tech tips