Safari Technology Preview:
StopTheMadness is fully compatible with Safari Technology Preview. However, enabling StopTheMadness in Safari does not automatically enable it in Safari Technology Preview, so you'll need to enable StopTheMadness in Safari Technology Preview's Preferences.
Privacy:
According to Safari's Preferences, StopTheMadness "Can read sensitive information from webpages, including passwords, phone numbers, and credit cards on all webpages" and "Can see when you visit all webpages". However, this is just boilerplate text from Apple shown for every Safari extension that can modify webpages. StopTheMadness does not read, use, or share your personal data. The privacy policy has more details about StopTheMadness privacy. See also my blog post The security of Safari extensions for a more detailed explanation of StopTheMadness permissions.
Why is the icon tinted in Safari?
Safari automatically tints most extension icons when the extension is active on the current web page. The tint is your accent color from General System Preferences. The StopTheMadness icon was originally designed to avoid this distracting tint, because StopTheMadness is active on every web page. However, Apple changed Safari version 15.1 so that StopTheMadness could no longer avoid the tint. You can read more about this change in my blog post.
Website Options:
You can selectively enable and disable StopTheMadness features. Your custom options can be configured to apply to every web page or just to web sites that you specify. To change the options, open the StopTheMadness popup in the toolbar of a Safari window, and select the Website Options tab.

- Bypass link shorteners: When enabled, StopTheMadness automatically checks the links you click for known link shorteners —
bit.ly
, tinyurl.com
, t.co
(Twitter), news.google.com
, etc. — and replaces the shortened URL with the unshortened destination URL. This occurs in a sandboxed process, without setting any cookies or other site data in Safari, so you can't be tracked by your click.
Known issue: If you middle-click with the mouse to open a shortened link in a new tab, and your Safari Preferences are set to open new tabs in the background, Bypass link shorteners may open the new tab in the foreground.
- Hide some banners: When enabled, "Sign in with Google" banners are hidden on all websites. The YouTube Premium banner is also hidden, as well as "Google recommends using Chrome" on Google Search.
- Hover shortcuts: When enabled, you can copy a link URL by hovering over it and pressing the keyboard shortcut (⌘-c) for the copy command, or copy a link title by hovering over it and pressing the keyboard shortcut (⌘-x) for the cut command. You can also hide an HTML element on the page by hovering over it and pressing the ⌘-delete keyboard shortcut. This triggers the hide page element feature.
If you've selected an app in the "Open Link with" popup menu, then hovering over a link and pressing the keyboard shortcut (⌘-v) for the paste command will open the link with the selected app. For example, you can use this feature as a keyboard shortcut to open links in Link Unshortener.
The keyboard shortcut ⌃⌘-v toggles the Show video controls feature, and ⇧⌘-v toggles the Video Highlight feature.
- Input maxlength warning: When enabled, StopTheMadness warns you if the characters you type or paste into a password field or other input field exceed the maximum length of the field. If this feature is disabled, then some of the characters you type or paste into a password field can get silently lost, with no warning.
- Protect ⌘-click: When enabled, ⌘-click (and middle-click with a mouse) always opens links in a new tab. When disabled, websites can prevent you from opening links in a new tab.
- Protect ⌘-key shortcuts: When enabled, ⌘-key shortcuts always go to Safari. When disabled, websites can hijack or disable keyboard shortcuts.
- Protect autocomplete: When enabled, autocompletion and AutoFill of user names, passwords, and other information always works in web forms. When disabled, websites can prevent AutoFill.
Warning: If you use a Chinese keyboard as an input source in System Preferences, it may not work right in text fields with Autocomplete enabled.
- Protect copy, cut, and paste: When enabled, you can always copy, cut, and paste text on a web page. When disabled, websites can prevent you from doing copy, cut, and paste.
- Protect drag and drop: When enabled, you can always drag and drop on a web page. When disabled, websites can prevent you from doing drag and drop.
- Protect option-key shortcuts: When enabled, option-key shortcuts always go to Safari. When disabled, websites can hijack or disable option-key shortcuts.
- Protect private windows: When enabled, websites cannot distinguish between private and non-private windows in Safari. When disabled, websites can detect private windows in Safari via JavaScript. Try this test page to demonstrate the technique.
- Protect tab closing & page visibility: When enabled, you can always immediately close a tab. When disabled, websites can stop you from closing a tab or window. Instead, Safari may show a popup alert that asks "Are you sure you want to leave this page?" when you try to close a tab or a window.
The Tab closing and visibility feature also prevents websites from observing visibilitychange
events, which are part of the Page Visibility API. Using this API, websites can learn when a tab is visible on your screen and when the tab is hidden. When Tab closing and visibility is enabled, websites can't observe when you show or hide a tab or your screen.
- Protect text selection: When enabled, you can always select text on a web page. When disabled, websites can prevent you from selecting text.
- Shadow DOM: When enabled, StopTheMadness website options such as Stop autoplaying videos and Show videos controls include HTML elements in the Shadow DOM. The Shadow DOM website option is enabled by default but can be disabled if it causes any website incompatibilities.
- Stop ⌘-arrow page navigation: Inside an editable text field, ⌘-left-arrow and ⌘-right-arrow put the cursor at the beginning or end of the current line of text. However, outside an editable text field, ⌘-left-arrow makes you navigate back to the previous page in your web browsing history, and ⌘-right-arrow makes you navigate forward. This page navigation is often accidental and unwanted! Stop ⌘-arrow page navigation prevents these keyboard shortcuts from causing page history navigation, while still allowing you to use the keyboard shortcuts in editable text fields. This feature is disabled by default. Enable it to prevent unwanted history navigation.
- Stop autosubmit of autofilled forms: In Safari 12.1 and later when you AutoFill a login form, Safari automatically submits the form. This can cause problems such as preventing you from checking "Remember Me", or sometimes even login failure. When you enable "Stop autosubmit of autofilled forms", Safari will no longer automatically submit login forms. Instead, StopTheMadness will display a confirmation asking whether you want to submit or cancel submission. See Stop autosubmit of autofilled forms for more details.
(Tip: When the confirmation is displayed, you can use the return key to submit or the escape key to cancel.)
- Stop link trackers: When enabled, your privacy is protected on the web in a a number of ways:
- Stops hyperlink auditing by removing the anchor "ping" attribute on link clicks.
- Stops tracking beacons (
Navigator.sendBeacon
) from firing.
- Prevents hijacking/rewriting of clicked links in Google Search results.
- Prevents hijacking/rewriting of clicked links in Gmail.
- Prevents hijacking/rewriting of clicked links in Facebook.
- Removes tracking tags such as
utm_source
(Urchin Tracking Module), gclid
(Google Click ID), and fbclid
(Facebook Click ID) from the end of the URL when you click, drag, or open a contextual menu on a link.
- Extracts the URL from redirects such as
l.facebook.com
, google.com/url
, youtube.com/redirect
, click.redditmail.com
, twitter.com/i/redirect
, and getpocket.com/redirect
.
- Stop scroll to text fragment: Text fragments are a new browser feature that automatically highlight text on a web page when a link is loaded. The text fragment is given after
#:~:text=
at the end of a link URL. When enabled, "Stop scroll to text fragment" removes the text fragment from the end of clicked links, so there's no text highlighting. This option is disabled by default.
This website option works only for links that you click in a web page, not for links that you load directly in the address bar. The reason is that web browsers hide the text fragment from web page scripts.
Video Options:
- Show video controls: When enabled, native video controls are shown by default, and you can always click on a video to control it or show the contextual menu for videos. When disabled, websites can cover videos with a transparent overlay that prevents you from directly controlling the video. This feature is disabled by default, because a lot of websites have custom video controls and don't use the HTML5 default controls.
When the "Hover shortcuts" website option is enabled, the keyboard shortcut control-command-v temporarily toggles Show video controls on the current page (without changing or saving your website settings).
If Show video controls doesn't work for a particular video, try Video Highlight.
- Include loops: Videos with the loop attribute are excluded by default from Show video controls, because loop videos are often used as page backgrounds and would cover the page if brought to the front. You can show video controls for loop videos too by enabling this option.
- Stop autoplaying videos: When enabled, videos are prevented from autoplaying. This happens regardless of Safari's Auto-Play Preferences, and it works even on sites where Safari's Auto-Play Preferences don't work, such as YouTube. When disabled, websites can autoplay videos without any user interaction. This feature is disabled by default.
Stop autoplaying videos also stops videos from following you down the page when you scroll on many websites! (More websites can be added by contacting support.)
Warning: When "Stop autoplaying videos" is enabled, you may not be able to use the play/pause media function key to start playing a video in Safari, though pause will still work.
- Video speed: Automatically select the playback speed for web videos. 1.0 is normal speed, 2.0 is double speed, 0.5 is half speed. (You can't select a negative number; that won't make videos play backward.)
Some sites such as YouTube resist speed changes and try to change the speed back. In those cases, you can enable Fixed speed to force the site to use your setting. The downside to Fixed speed is that you won't be able to manually change the speed of the video either.
YouTube Options:
- Show Picture-in-Picture button: When enabled, the Picture-in-Picture button is shown in YouTube's video controls, and the YouTube Miniplayer button is hidden. This feature is disabled by default.
- Skip video ads: When enabled, Skip video ads automatically fast-forwards through YouTube ads when you play! This feature is disabled by default.
- Video quality: Automatically select the video quality when you play YouTube videos. Automatic quality selection works even with embedded YouTube videos on non-YouTube sites. If the specific video quality you selected, such as 8K, is not available, then the next highest available quality will be automatically selected.
- Copy Link Title menu item: When enabled, StopTheMadness inserts a "Copy Link Title" item into Safari's contextual menu. This menu item copies the visible title of a link. (In contrast, the built-in "Copy Link" menu item copies the URL of a link.) When disabled, "Copy Link Title" does not appear in Safari's contextual menu.
- Open Link with… menu item: When enabled, StopTheMadness inserts an "Open Link with" item into Safari's contextual menu, but only if an app is selected in the "Open Link with" popup in the website options. This contextual menu item opens the link in an alternative web browser. When disabled, "Open Link with" does not appear in Safari's contextual menu.
- Protect contextual menus: When enabled, you can always open Safari's contextual menu. If you still need to open a web site's custom contextual menu instead of Safari's contextual menu, just press the option key while you open the menu. When disabled, websites can prevent you from opening the contextual menu or substitute their own menu for Safari's. YouTube and Google Maps are examples of sites that disable Safari's contextual menu.
Only with option key: When enabled, the behavior of "Protect contextual menus" is reversed, activating only if you also press the option key while opening the contextual menu. You may want to enable this website option if you have other Safari extensions with custom contextual menu items, because "Protect contextual menus" may inadvertently may prevent other Safari extensions from adding custom menu items to Safari's contextual menu.
- Video Controls menu item: When enabled, StopTheMadness inserts a "StopTheMadness Video Controls" item into Safari's contextual menu. This menu item temporarily toggles the Show video controls website option on the current page (without changing or saving your website settings).
- Video Highlight menu item: When enabled, StopTheMadness inserts a "StopTheMadness Video Highlight" item into Safari's contextual menu. This menu item toggles the Video Highlight feature.
New Tab Behavior:
(External links are cross-site, with a different domain than the current web site.)
- Default: Allow web sites and the web browser to decide whether or not to open a link in a new tab.
- Force external links into same tab, Force all links into same tab: Web sites frequently add
target="_blank"
to a link to make the link automatically open in a new tab when you click. If you prefer to open links in the current tab instead of a new tab, you can enable this feature, which removes target="_blank"
from links. When enabled, normal link clicks always open in the current tab. (You can still ⌘-click to open the link in a new tab.) When this feature is disabled, some links may automatically open in new tabs when clicked.
- Force external links into new tabs, Force all links into new tabs: When enabled, links will always open in a new tab. When this feature is disabled, links usually open in the same tab.
- Open external links with, Open all links with: When enabled, clicked links will open in the alternative web browser selected by the "Open Link with" popup instead of opening in Safari.
Open Link with:
Select the alternative web browser to be used by the "Open Link with" contextual menu item, the hover shortcut ⌘-v, and the new tab behaviors "Open external links with" and "Open all links with". Select the empty top row of the popup menu to disable all of these website options. If you have Link Unshortener installed, you can set it as the alternative web browser. StopTheMadness and Link Unshortener were designed to work together.
Dangerous Options (Site Breakage):
The features labeled "Dangerous Options" are intended to be used sparingly, only on specific sites where you know you need them, because otherwise they can cause a large number of incompatibilities on other sites.
- Bring images to the front: When enabled, all images on the page are forced to the front. This can help on websites such as Instagram that put a transparent overlay in front of images, which prevents you from dragging or opening the contextual menu for an image. Images in front is disabled by default, because it can mess up the page layout on some sites.
- Protect escape key: When enabled, stops websites from hijacking the escape key. (Note: textareas are not covered by "Protect escape key" unless the "Protect textareas" option is also enabled.)
- Protect return key: When enabled, stops websites from hijacking the return key. (Note: textareas are not covered by "Protect return key" unless the "Protect textareas" option is also enabled.)
- Protect other keys: When enabled, stops websites from hijacking key presses on the page (except for the escape and return keys, which are covered by the separate options above). It usually shouldn't be necessary, but in some rare cases a website will go to extreme lengths to interfere with your typing. (Note: textareas are not covered by "Protect other keys" unless the "Protect textareas" option is also enabled.)
- Protect all links: When enabled, stops websites from hijacking link clicks ("clickjacking"). It usually shouldn't be necessary, because "Protect ⌘-click" and "Stop link trackers" already cover many cases, but "Protect all links" covers all cases. It's not enabled by default, because it can break some links.
- Protect all mouse clicks: When enabled, stops websites from hijacking mouse clicks on the page. It usually shouldn't be necessary, but in some rare cases a website will go to extreme lengths to prevent you from selecting text on the page. If the "Protect text selection" feature is not sufficient to enable text selection on a page, you may need to enable "Protect all mouse clicks" too in order to select text. In order to protect links clicks rather than clicks elsewhere on a web page, look at "Protect all links" instead.
- Protect focus and blur: A focus event occurs when a website element gets the keyboard focus, and a blur event occurs when a website element loses the keyboard focus. When enabled, the Protect focus and blur feature stops websites from capturing these events.
- Protect mouse movement: When enabled, websites cannot use JavaScript to track the movement of your mouse pointer on the web page. You may want to enable this feature to protect your privacy. It can also stop popups from appearing when hovering over links on sites such as Wikipedia and Twitter. When this feature is disabled, websites can use JavaScript to track the movement of your mouse pointer.
- Protect scrolling: When enabled, websites cannot prevent or hijack scrolling. Websites often use "scrolljacking" for annoying purposes, such as popup videos on scroll. When the Protect scrolling option is disabled, websites can scrolljack. This feature is disabled by default, because it causes incompatibilities with a number of websites, especially sites with "infinite scrolling". See Known Issues for a few examples.
- Protect textareas: When enabled, multi-line text editors (HTML
textarea
elements) are also protected by the website options "Protect ⌘-key shortcuts", "Protect copy, cut, and paste", and "Protect text selection". By default, only single-line editors (HTML input
elements) are protected, because multi-line editors don't usually prevent copy and paste, and a lot of websites have special multi-line "rich text" editors with highly customized editing that can break with the Protect textarea feature enabled. However, you may need to enable this feature on certain websites if they disable copy and paste.
- Stop new windows: When enabled, websites are prevented from using the
window.open()
API to open a new window or tab. This API is sometimes used for annoyances such as sending you to an advertiser's site.
Note: "Stop new windows" is different and separate from the "Force all links into same tab" website option, which deals with the target="_blank"
API.
- Stop repeating timers: The setInterval() function creates a timer on a web page. When the Stop repeating timers option is enabled, it stops these timers from getting triggered. This can prevent unwanted site updates.
When you change the website options in StopTheMadness, those changes apply immediately to the active Safari tab, and will apply to all web pages loaded thereafter in any tab. If you already had a web page open in a background tab before you changed the website options, and you want the changes to apply immediately to that web page, you need to switch to the tab and reload the page.
How to Add Website Options:
The Default options for all websites apply to every web page in Safari, unless you have custom options for a particular site. To create custom options for a website, press the + button. There are two ways to specify websites: domain or URL. Examples of domains are "apple.com
" and "google.com
". If you specify a domain, then subdomains of that domain are automatically covered too. For example, "google.com
" also covers "www.google.com
", "mail.google.com
", etc. If you want a subdomain to have different options than its domain, create a separate item for the subdomain. The longest match always wins, so if you have items for both "google.com
" and "mail.google.com
", then your "mail.google.com
" options will apply when you load the page "https://mail.google.com/
". If you want options to apply only to subdomains but not to the domain, put a dot at the beginning: ".google.com
" applies to "https://www.google.com/
", etc., but not to "https://google.com/
".
You may want to apply custom options only to certain paths of a website, in which case you need to specify the website as a full URL. For example, if you enter "https://www.google.com/maps
", then the custom options will only apply to Google Maps and not to Google Search at "https://www.google.com/
". Subpaths are automatically covered too: "https://www.google.com/maps
" would also cover "https://www.google.com/maps/search/apple+park
". You can customize subpath options by creating a separate item for the subpath. As with domains, the longest match among URLs always wins. And a URL setting that includes a domain will override a domain setting for the same domain, since the URL is longer. So "https://www.google.com/maps
" takes precedence over "www.google.com
".
Video Highlight:
When you press the Video Highlight button, everything on the current web page becomes hidden except videos. (If there are no videos, the page will be blank.) Pressing the button again toggles page visibility back on. Video Highlight is temporary and gets reset when you navigate to a new page in the current tab.
Video Highlight is great for accessing all of the native video controls. The website option "Show video controls" works on the majority of videos, but there are some exceptions, and in those cases Video Highlight should work. Or if you prefer, you can use Video Highlight instead of "Show video controls".
When the "Hover shortcuts" website option is enabled, the keyboard shortcut option-command-v triggers the video highlight feature.
Custom <style>
element and Custom <script>
element:
If you enter text into this area, StopTheMadness will create a custom HTML <style>
or <script>
element on the web page. The text you enter will become the element's inline CSS or JavaScript. If the text area is empty, then no custom element is created on the web page. StopTheMadness doesn't check your syntax, so you'll probably want to copy the CSS and JS from elsewhere and paste it into StopTheMadness, for example from userscript sites such as Greasy Fork.
The custom CSS or JS that you enter in the Custom Elements tab applies to the current selection in the Website Options tab. Custom Elements are in a separate tab in order to provide enough space for text entry.
You can enable "Also use Default options for all websites" to make the selected website inherit any custom CSS or JS that you've defined in the Default options. This allows you to use your custom CSS or JS on every website, including websites with customized options.
Technical notes: Custom elements are loaded into all frames on the web page. The custom <script>
element is created after the DOMContentLoaded
event, and you can check if (window === window.top)
in JavaScript for the top frame.

Safari style sheet customization: This is a legacy feature, superseded by Custom CSS, but the feature is still available for use if desired. When enabled, StopTheMadness adds the attribute stopthemadness-href
with the value of the URL of the page to the html
element of the page. You can use this attribute to write site-specific CSS in your Safari style sheet. You can set your .css
file as the style sheet in the Advanced tab of the Preferences window in Safari. (Note: If you edit your style sheet while Safari is open, you'll need to relaunch Safari for the changes to take effect.)
For more details, along with useful examples of site-specific CSS, see StopTheMadness for Safari Style sheet.
Font Replacements:
You can replace one font with a different font on websites by creating a font replacement rule. The replacement can be either a system font from your Mac or a web font from a URL. The font URL can be absolute (https://
) or a path relative to the URL of the website. To use one of Apple's San Francisco fonts, select it under the System category in the Replacement Font popup.
One limitation is that Safari refuses to display user-installed local fonts. The only local replacement fonts allowed are system fonts. This limitation is caused by tracking prevention in WebKit. Unfortunately there's no known workaround for this limitation.
When you create a font replacement rule, StopTheMadness automatically adds the appropriate @font-face CSS rules to the page. To replace a generic font-family name, select Serif, Sans-serif, or Monospace under the Generic category in the Original Font popup. To replace the default Safari font, use Times for the Original Font Name, because Safari uses Times when no font is specified by the page.
Use the Style popup if you need fine-grained control over font replacement for particular styles such as bold or italic.
You can enable "Also use Default options for all websites" to make the selected website inherit any font replacement rules that you've defined in the Default options. This allows you to use your font replacement rules on every website, including websites with customized options.
Use my Safari content blocker StopTheFonts to block web fonts entirely. When web fonts are blocked, Safari falls back to system fonts, and your replacements rules in StopTheMadness will apply in that case.
Redirects:
StopTheMadness can automatically redirect URLs so that when you open a link to one web site, your web browser loads a different site of your choosing. For example, you can redirect new Reddit to old Reddit if you prefer the old user interface. Or you can use privacy-preserving alternatives to popular web sites such as Nitter for Twitter and Invidious for YouTube.

StopTheMadness uses the JavaScript function String.replace()
to redirect URLs. To create a redirect, you need a URL matching pattern and a replacement for that pattern. The matching pattern can be either a substring of the URL or a regex expression enclosed in "/" characters. The replacement is always a substring, though there are some special characters you can use in the replacement, as explained by the String.replace()
documentation. Examples:
URL matching pattern:
https://www.reddit.com/
Replacement:
https://old.reddit.com/
URL matching pattern:
https://twitter.com/
Replacement:
https://nitter.net/
URL matching pattern:
/^https://en\.wikipedia\.org/([^?#]+)([^?]*)$/
Replacement:
https://en.wikipedia.org/$1?useskin=vector$2
URL matching pattern:
/^mailto:/
Replacement:
https://mail.google.com/mail/?view=cm&fs=1&to=
URL matching pattern:
/^http:/
Replacement:
https:
The redirect rules are matched in the order they appear in StopTheMadness, though the order usually shouldn't matter if the rules are for different domains. If needed, you can drag and drop to change the order. You can also use the checkboxes to temporarily disable a rule.
The Redirects are checked by StopTheMadness before the Web URL Rules, so the two features can be combined to redirect a URL and then open the redirected URL in another app.
Temporarily disable the extension:
If you need to quickly disable the Safari extension temporarily, just uncheck "Extension enabled" at the top of the popup. The toolbar icon will be badged with "OFF". The extension remains disabled until you check "Extension enabled" again.

Known Website Compatibility Issues:
In these cases you may want to create custom website options and disable the specific feature.
Mastodon: (1) Show video controls requires Include loops. (2) Stop link trackers opens images in new tabs instead of in the image carousel popup.
SmugMug (smugmug.com
): Disable "Protect drag and drop" and "Stop link trackers" to fix reordering photos.
Protect scrolling: apple.com
, icloud.com
, cnn.com
, netflix.com
, reddit.com
, smartsheet.com
, twitter.com
Show video controls: hulu.com
, netflix.com
, nfl.com
Stop autoplaying videos: paramountplus.com
Airtable (airtable.com
): Disable "Protect ⌘-key shortcuts" to fix ⌘C and ⌘V for cells.
Protect copy, cut, and paste: https://online.citi.com/US/ag/activate/index