0

www.example.com/urlDontExistsなどの無効な URL をキャッチすると、次のように検索ページにリダイレクトされます。

Response.Redirect("/Search");

「urlDontExists」というタグをフォームに送信して、検索ページに行って「urlDontExists」で検索したのと同じ結果を表示したいと考えています。

次のような QueryString で可能であることはわかっています。

Response.Redirect("/Search?searchtag=urlDontExists");

しかし、私は QueryString には入れたくない

これは可能ですか?

4

1 に答える 1

0

そのためにjQueryを使用できます。

$(document).ready(function() {
    // Get the parameters and fill the search form here
    var location = window.location;
    // modify the querystring so that urlDoesntExist is removed from the titlebar
    ...
    window.location.replace(modified_url);
})

これは大きなハックであることに注意してください。

于 2011-03-17T11:53:30.967 に答える