Skip to content

Instantly share code, notes, and snippets.

@Dids
Last active February 7, 2024 04:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dids/c1a884f7450dc7a0aae5476edbffb683 to your computer and use it in GitHub Desktop.
Save Dids/c1a884f7450dc7a0aae5476edbffb683 to your computer and use it in GitHub Desktop.
Fix YouTube on Safari in a quick and easy manner, all with official and legit tools and steps!

SafariTube - Fix YouTube on Safari

What is this?

SafariTube is a simple userscript for Tampermonkey, which simply makes YouTube think it's running on Chrome, enabling a much better user experience, from features such as hover previews to improved video playback and an overall improved YouTube experience.

How do I use it?

  1. Install Tampermonkey from the (Mac) App Store
  2. Configure Tampermonkey to your liking (optional, but recommend checking general update settings in particular)
  3. In Tampermonkey, go to Utilities and look for Import from URL, then specify the downloadURL or updateURL from the script below (they're the same), then click the Install button and continue with the script installation
  4. Enjoy a better YouTube experience, as well as automatic updates to this script*!

*As long as I remember to update it, if and when it breaks!

// ==UserScript==
// @name SafariTube
// @namespace https://github.com/Dids
// @version 0.1.3
// @description Makes YouTube on Safari think it's running on Chrome, enabling a much better user experience.
// @website https://gist.github.com/Dids/c1a884f7450dc7a0aae5476edbffb683
// @downloadURL https://gist.githubusercontent.com/Dids/c1a884f7450dc7a0aae5476edbffb683/raw/SafariTube.js
// @updateURL https://gist.githubusercontent.com/Dids/c1a884f7450dc7a0aae5476edbffb683/raw/SafariTube.js
// @author Dids
// @match https://www.youtube.com/
// @match https://www.youtube.com/*
// @match https://*.youtube.com/
// @match https://*.youtube.com/*
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAEKADAAQAAAABAAAAEAAAAAA0VXHyAAACQklEQVQ4EZVTy2sTcRD+NonJhiaxNXVFYyJNDTGNNIoivkhsDvFxKF4akXoTvOm9gqHEQxDEf6AIUvUiHkQ81EqttlXE92trsVrSxCCWrK3d1N2kSdedH6QEH6QOLD9mZ755fsPhNwmnxO2N8zPJWbszIvOOBjLb1fmFJll6OOcQEiM9wVe1EK6qBHtFc2tp5rZqssZOjFzmDrwfhDs/zczZ5k0Y3hrD9fBJjS8rg5/NQqfYGyyRkQUgsEsrTO7/cN9z7kZPNeZf3/PxFMYC0UyOs/koiIG8KPNKwORLCciXMKRz1DOvyC/uJncvt0OGenIw8URTrfYdxtCurr5jj/r9NlWG5BDglPP4uCGAsnEVnm/ew/RpwQtrScHjQASWxSJmbU6sVn5wU4LXZaJpd+gDu7m3G7zutGCxoS92GtG3A8isbdGBP9HfcQpn7lzAvdARiO52mCoVHH55i/wiBloVTdslZRlgtC2KYOYNJlxBxMeu4qlvH9Of6dW0Zd/BoC2x7gjD1rztUrqiARp9SxzH3qpe7yWsiUii79lOEXNr3Lh4NMHKsxYVfFrvx+uWnfDk0+AXFdbi8dEraFALIG4Q1kAMe6CThGSjlGFlbvkyDsneDNXMs/+y1YEKZ0RT4TvMZcYfRizC/rHGqXU+eL9NYqj9EPy5cYieEIS5r7CUi0gLrQiLQ6CNVdfIMnSeHR5IxlMr7p98CUNgxkTiNtGTaFpPqlQmDPkus6/2mLr1YyJu1B4Tzenav46pNuv/nvMvLppLep1zaiIAAAAASUVORK5CYII=
// @grant none
// ==/UserScript==
(function() {
'use strict';
// TODO: Automate the user agent versioning etc. so occasionally it gets auto-updated from various online databases
Object.defineProperty(navigator, 'userAgent', {
value: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36'
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment