Javascript -重定向参数URL只有一次


// ==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';

这是我到目前为止的代码。但/?旁观者=true是永远添加的,我希望它只添加一次。

/?观众= true

(例如:tagpro-123.koalabeast.com:8000/?spectator=true)到URL只一次?提前谢谢。

请注意,这不是一个重复,我尝试了其他链接,它没有工作,所以请提供完整的代码和解释给我。非常感谢!

if (window.location.search != '?spectator=true') {
   window.location = window.location+'/?spectator=true';
}

最新更新