Skip to content

Bookmarklets

Alex Shnitman edited this page Jul 17, 2026 · 1 revision

Bookmarklets let you send the currently open webpage to MeTube with one click from your bookmarks bar.

Prerequisites

  • HTTPS: if you're on an HTTPS page (e.g. youtube.com), your MeTube instance must be served over HTTPS too — either with HTTPS=true in the environment or behind an HTTPS reverse proxy (see Reverse proxy configurations) — otherwise the browser blocks the request as mixed content.
  • CORS: bookmarklets run in the context of the current page, so their requests to MeTube are cross-origin. Add the origins of the sites where you use the bookmarklet to the CORS_ALLOWED_ORIGINS environment variable, e.g. CORS_ALLOWED_ORIGINS=https://www.youtube.com,https://www.vimeo.com.

GitHub doesn't allow embedding JavaScript as a link, so create a new bookmark on your bookmarks bar manually and paste the code below as its URL. Change metube.domain.com to point to your MeTube instance.

Chrome

Contributed by kushfest.

javascript:!function(){xhr=new XMLHttpRequest();xhr.open("POST","https://metube.domain.com/add");xhr.withCredentials=true;xhr.send(JSON.stringify({"url":document.location.href,"quality":"best"}));xhr.onload=function(){if(xhr.status==200){alert("Sent to metube!")}else{alert("Send to metube failed. Check the javascript console for clues.")}}}();

Firefox

Contributed by shoonya75.

javascript:(function(){xhr=new XMLHttpRequest();xhr.open("POST","https://metube.domain.com/add");xhr.send(JSON.stringify({"url":document.location.href,"quality":"best"}));xhr.onload=function(){if(xhr.status==200){alert("Sent to metube!")}else{alert("Send to metube failed. Check the javascript console for clues.")}}})();

Toast notification variant

The above bookmarklets use alert() for notifications. This variant shows a toast instead (Chrome — for Firefox, replace the !function(){...}() wrapper with (function(){...})()):

javascript:!function(){function notify(msg) {var sc = document.scrollingElement.scrollTop; var text = document.createElement('span');text.innerHTML=msg;var ts = text.style;ts.all = 'revert';ts.color = '#000';ts.fontFamily = 'Verdana, sans-serif';ts.fontSize = '15px';ts.backgroundColor = 'white';ts.padding = '15px';ts.border = '1px solid gainsboro';ts.boxShadow = '3px 3px 10px';ts.zIndex = '100';document.body.appendChild(text);ts.position = 'absolute'; ts.top = 50 + sc + 'px'; ts.left = (window.innerWidth / 2)-(text.offsetWidth / 2) + 'px'; setTimeout(function () { text.style.visibility = "hidden"; }, 1500);}xhr=new XMLHttpRequest();xhr.open("POST","https://metube.domain.com/add");xhr.send(JSON.stringify({"url":document.location.href,"quality":"best"}));xhr.onload=function() { if(xhr.status==200){notify("Sent to metube!")}else {notify("Send to metube failed. Check the javascript console for clues.")}}}();

Clone this wiki locally