私はヒストリクラスのための検閲されたgoogleのモックバージョンに取り組んでいます。ユーザーは検索語を入力し、用語が「検閲」されている場合は検閲ページに移動し、そうでない場合は実際のGoogleページに直接移動します。しかし、Firefoxのみでは、検索はGoogleページにリダイレクトされていないように見えますが、スクリプトの検閲部分のみが機能します。 Google Chromeをチェックインしても問題ありません。何か案は?ここでFirefox JavascriptのURLリダイレクト
はコードです: HTML:
<input type="text" id = "search" name="search" size="85" onKeyUp="searchCensor()"/><br />
Javascriptを:
function searchCensor()
{
var keyTerms = document.getElementById("search").value;
if(keyTerms == "censorship")
window.location = "http://andrewgu12.kodingen.com/history/censor.php";
else if(window.event.keyCode == 13)
window.location = "https://www.google.com/search?q="+keyTerms;
}
ウェブサイト:http://andrewgu12.kodingen.com/history/