Stay on the Google Cache page

Prevent the site from navigating away from Google Cache pages, as the target page may no longer exist

  1. // ==UserScript==
  2. // @name Stay on the Google Cache page
  3. // @name:zh-CN 拦截Google快照跳转
  4. // @version 1.0
  5. // @description Prevent the site from navigating away from Google Cache pages, as the target page may no longer exist
  6. // @description:zh-CN 某些站点会在Google快照页面强行跳转离开,然而可能目标页面早已404,此脚本用来阻止跳转
  7. // @namespace https://webcache.googleusercontent
  8. // @author PatrickZ
  9. // @match https://webcache.googleusercontent.com/search?q=cache:*
  10. // @run-at document-start
  11. // @license MIT
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17. window.onbeforeunload = function() {
  18. return "Are you sure?";
  19. };
  20.  
  21. })();