我想將URL重定向到不同的URL。例如,如果我輸入:通過Greasemonkey重定向鏈接
google.com
並回車,就應該我重定向到:
yahoo.com
I was at a previous thread and found a code for this,但不幸的是,它適用於所有的網址,我不想。此外,一旦重定向完成(在yahoo.com),頁面將重新加載,無限循環。
編輯:目前代碼:
// ==UserScript==
// @name Google to Yahoo
// @description Redirects Google to Yahoo
// @include http://*.google.*/*
// @version 1
// ==/UserScript==
if(content.document.location == "http://google.com"){
window.location.replace("http://yahoo.com")
}
你通過Greasemonkey的運行此,正確嗎?自從我做Greasemonkey以來已經有一段時間了,但是'@ include'指令應該阻止它在所有的URL上工作。 – Shoaib