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 というクラスが存在しますが、今回紹介したものもなかなかシンプルに使えてよいのではないでしょうか。
スポンサード リンク
Advertisements
SITE PROFILE
最新のブログ記事(新着順)
- 2012年2月10日 管理人のブックマーク
- ブラウザ上でPDFを表示するJSライブラリ「PDF.js」
- 次世代の検索フォームを作成するjQuery&CSS3サンプル
- 2012年2月9日 管理人のブックマーク
- faviconを書き換えてfacebookの通知っぽくしてくれるfaviconアラート実装ライブラリ「Tinycon」
- ページめくりを実現するためのjQueryプラグイン集
- 2012年2月8日 管理人のブックマーク
- HTMLをアップするとCSSのスケルトンを自動生成してくれる「bearcss」
- HTML5で綺麗でインタラクティブなグラフが描けるライブラリ「Flotr2」
- 2012年2月7日 管理人のブックマーク
- 過去のエントリ



















間違いの指摘をしていただける方はメール、あるいはTwitterでお願いします(クリック)




