-1

PS3を使用している場合、ユーザーを別のWebページにリダイレクトしてほしい

これが私が使おうとしているコードです

<script language=javascript>
<!--
if ((navigator.userAgent.match(/iMozilla/i)) || (navigator.userAgent.match(/iPLAYSTATION 3/i))) {
   location.replace("http://example.com");
}
-->
</script>

PS3のユーザーエージェントのリストはここにありますhttp://www.useragentstring.com/pages/Playstation%203/

私はそれを機能させることができないようですが、私は何が間違っているのですか?

4

1 に答える 1

2

あなたはこのようなことを試すことができます:

<script language=javascript>
    var uAgent = navigator.userAgent;
   if (uAgent.indexOf("PLAYSTATION") != -1) {
      window.location = ("http://example.com");
   }
</script>

このサーバー側でも実行する方が簡単な場合があります(以下のC#ex)

  if (Request.UserAgent.ToUpper().Contains("PLAYSTATION"))
      //Send to correct page
      Response.Redirect("http://www.example.com/");
  }
于 2011-07-21T16:59:08.823 に答える