【问题标题】:UserScript : rewrite a specific URL [duplicate]UserScript:重写特定的 URL [重复]
【发布时间】:2020-01-25 08:56:44
【问题描述】:

我一直在寻找一种通过用户脚本(GreaseMonkey、TamperMonkey...)重写特定 URL 的方法。我找到了替换特定域的所有部分的解决方案,而不仅仅是一个 url。

更准确地说,在 iCloud 邮件 (icloud.com/mail) 上,我想替换 https://www.icloud.com/message/current/en-us/index.html#composehttps://mail.google.com/mail/?view=cm&fs=1&tf=1

我根本不是脚本专家,我不知道从哪里开始

非常感谢

【问题讨论】:

    标签: url url-rewriting greasemonkey tampermonkey userscripts


    【解决方案1】:

    没关系,玩了之后我找到了解决方案

    // ==UserScript==
    // @name rewrite
    // @namespace https://icloud.com/
    // @version 1.0
    // @author Gee
    // @match  https://www.icloud.com/message/*
    // @include * https://www.icloud.com/message/*
    // @grant none
    // ==/UserScript==
    
    var current_url = document.location;
    var new_url = "https://mail.google.com/mail/?view=cm&fs=1&tf=1";
    location.replace(new_url);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-08
      相关资源
      最近更新 更多