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
|
![]()
間違いの指摘をしていただける方はメールでお願いします
最新のブログ記事
- Facebook風のサムネイル付きサジェストボックスを実装するサンプル
- 2009年7月3日 管理人のブックマーク
- PHPとCSSで動的に綺麗なパーセンテージグラフを描画サンプル
- 普通の写真をすばらしいアートにするためのPhotoshopチュートリアル集
- シマシマの見やすいテーブルを作成するMooToolsプラグイン「ZebraTable」
- 2009年7月2日 管理人のブックマーク
- 「フォローしてね」を表すTwitterアイコン集
- シンプルなTwitter検索を行うためのPHPスクリプト
- PHPのcURLを使ってできる便利なサンプル集
- 2009年7月1日 管理人のブックマーク
- iPhone3.0の緯度経度APIで移動履歴を地図描画するサンプル





















