Disable Web Share API on Bahn.de

Restores the text pop-up on travel connections for easy copy&paste. Technically overrides navigator.share to prevent native share dialog. Restricted to Bahn.de sites.

  1. // ==UserScript==
  2. // @name Disable Web Share API on Bahn.de
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Restores the text pop-up on travel connections for easy copy&paste. Technically overrides navigator.share to prevent native share dialog. Restricted to Bahn.de sites.
  6. // @match https://bahn.de/*
  7. // @match https://www.bahn.de/*
  8. // @run-at document-start
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. // Override navigator.share before any page script runs
  14. Object.defineProperty(navigator, 'share', {
  15. configurable: true,
  16. enumerable: true,
  17. writable: false,
  18. value: undefined
  19. });
  20. })();