【发布时间】:2015-11-13 09:02:40
【问题描述】:
// ==UserScript==
// @name TamperMonkey Redirect
// @include http://tagpro-*.koalabeast.com:*
// @include http://tangent.jukejuice.com:*
// @include http://maptest*.newcompte.fr:*
// @version 1.0
// ==/UserScript==
window.location = window.location+'/?spectator=true';
这是我到目前为止的代码。但是 /?spectator=true 会被永久添加,我希望它只添加一次。
/?spectator=true
(例如:tagpro-123.koalabeast.com:8000/?spectator=true)到该 URL 仅一次?提前致谢。
请注意,这不是重复的,我尝试了另一个链接它不起作用,所以请向我提供完整的代码和解释。非常感谢!
【问题讨论】:
-
我认为我没有看到任何实际代码...也许发布一些?
-
if(window.location.indexOf('/?spectator=true') === -1)window.location = window.location+'/?spectator=true';
标签: javascript google-chrome url redirect userscripts