From dac1b468d5432ff9166fe221ac520b5050a65f0e Mon Sep 17 00:00:00 2001
From: Phil Sturgeon
Date: Thu, 6 Jan 2011 17:40:10 +0000
Subject: Altered User agent library so that is_browser(), is_mobile() and
is_robot() can optionally check for a specific browser or mobile device.
---
user_guide/libraries/user_agent.html | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
(limited to 'user_guide/libraries/user_agent.html')
diff --git a/user_guide/libraries/user_agent.html b/user_guide/libraries/user_agent.html
index 944f1ed86..d2f79d2ec 100644
--- a/user_guide/libraries/user_agent.html
+++ b/user_guide/libraries/user_agent.html
@@ -111,9 +111,34 @@ echo $this->agent->platform(); // Platform info (Windows, Linux, Mac, etc.)
$this->agent->is_browser()
Returns TRUE/FALSE (boolean) if the user agent is a known web browser.
+ if ($this->agent->is_browser('Safari'))
+{
+ echo 'You are using Safari.';
+}
+else if ($this->agent->is_browser())
+{
+ echo 'You are using a browser.';
+}
+
+Note: The string "Safari" in this example is an array key in the list of browser definitions.
+You can find this list in application/config/user_agents.php if you want to add new browsers or change the stings.
+
$this->agent->is_mobile()
Returns TRUE/FALSE (boolean) if the user agent is a known mobile device.
+ if ($this->agent->is_mobile('iphone'))
+{
+ $this->load->view('iphone/home');
+}
+else if ($this->agent->is_mobile())
+{
+ $this->load->view('mobile/home');
+}
+else
+{
+ $this->load->view('web/home');
+}
+
$this->agent->is_robot()
Returns TRUE/FALSE (boolean) if the user agent is a known robot.
--
cgit v1.2.3-24-g4f1b
From 700205ad5cb6c00596ad82d5ed282f516add5481 Mon Sep 17 00:00:00 2001
From: Derek Jones
Date: Fri, 28 Jan 2011 07:44:28 -0600
Subject: updating copyrights to 2011
---
user_guide/libraries/user_agent.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'user_guide/libraries/user_agent.html')
diff --git a/user_guide/libraries/user_agent.html b/user_guide/libraries/user_agent.html
index d2f79d2ec..8989fb2e1 100644
--- a/user_guide/libraries/user_agent.html
+++ b/user_guide/libraries/user_agent.html
@@ -219,7 +219,7 @@ Previous Topic: URI Class
User Guide Home ·
Next Topic: XML-RPC Class
-CodeIgniter · Copyright © 2006-2010 · EllisLab, Inc.
+CodeIgniter · Copyright © 2006 - 2011 · EllisLab, Inc.