画面の幅が 420 ピクセル未満かどうかを検出する CSS コードを含む ASP.NET Web フォーム Web サイトがあります。クライアントは現在、このバージョン (420 ピクセル未満) を全画面サイトとは大きく異なる機能にすることを望んでいるため、サーバー側でブラウザーの幅を検出することで、Web サイトのモバイル バージョンにリダイレクトできると考えました。Request.Browser.ScreenPixelsWidth をチェックするために 51Degrees を使用していますが、携帯電話でも常に同じ値を返します。この情報を検出して、自分の Web ページのモバイル バージョンを読み込めるようにするためのより良い方法はありますか?
2 に答える
If you want to get device-width, user-agent
is not very helpful, because ultimately you need screen resolution and that will be the sole criteria to manage UI. So when more devices will come into market, you need to store their useragent and their dimension, this way, i am saying it is not helpful. And what if user has mobile or tablet, and changes orientation, means dimension just got changed for same user-agent
.
So best way would be to go with css media
queries to start with. There are lot of CSS to help you out for responsive design , such as bootstrap
.
2 つの異なるテクノロジを混在させています。レスポンシブ デザインの場合、ブラウザー エージェント スニッフィングを使用する必要はありません。Bootstrap などの RWD CSS フレームワークを使用します。RWD を使用すると、すべてのデバイスに同じコンテンツと機能を提供できます。
これは、別の機能が必要な部分がある場合に、別のモバイル アプリを開発するという議論のように聞こえます。それ以外では、クライアントはばかであり、クライアントを教育することが私たちの仕事であることがよくあります;-)