パラメータ付きのリンクをリダイレクト先に渡す

http://example_A.com?hoge」にhoge付きでやってきたら、「http://example_B.com?hoge」へリダイレクトしたくなった。

<script type="text/javascript">
<!--
//パラメータ
var params = location.href.split("?")[1];
//console.log(params);
var path="http://(リダイレクト先のURL)";

//パラメータの有無を判断
if(typeof(params) != "undefined") { 
  path = path + "?" + params;
}

var meta_str = "<meta http-equiv='refresh' content='0; URL=" + path + "'>";
$("head").prepend(meta_str);
// -->
</script>

これで飛びまくってくれる。