PHPで使えるブラウザ等プラットフォーム検出用クラス
2006年11月07日
スポンサード リンク
Browser Detection with PHP
Browser detection is an illusive task that is ultimately doomed to fail. Browsers are always changing and keeping up to date with these changes is a continuous job. Some browsers allow the user to alter the way the browser identifies itself, or to not identify itself at all. Some firewalls block the sending of the browser identification, so no browser detection scheme is entirely successful.
PHPで使えるブラウザ等のプラットフォーム検出用クラス。
次のサンプルで簡単に各種情報をPHPにて取得できます。Opera/Safariなんかにも対応してます。
<?php
require('detect.php');
$b = new browser();
echo $b->Name; // 「MSIE」などのブラウザ名を取得
echo "<br>";
echo $b->Version; // 「6.0」などのバージョンを取得
echo "<br>";
echo $b->Platform; // 「Windows」などのOSを取得
?>
PEAR にも Net_UserAgent_Detect というクラスが存在しますが、今回紹介したものもなかなかシンプルに使えてよいのではないでしょうか。
スポンサード リンク
投稿者 KJ : 2006年11月07日 11:09
|
![]()
間違いの指摘をしていただける方はメールでお願いします
最新のブログ記事
- 2008年8月21日 管理人のブックマーク
- エラーコード/エラーメッセージの検索エンジン「ErrorKey」
- タグでのブックマークを軽快に行えるFirefox拡張「Tagmarks」
- Photoshop用、美しい光のブラシ集
- 2008年8月20日 管理人のブックマーク
- 目のアップの画像を迫力ある画像にするPhotoshopチュートリアル
- 自動再生されるコンテンツスライダー実装
- IEでボックス要素を45度傾けることが出来る「Transformie」
- 2008年8月19日 管理人のブックマーク
- オンラインで動作するPhotoshop風画像編集ツール「pixlr」
- パスワードの強度を示してくれるJS「Ext.ux.PasswordMeter.js」


















