diff options
Diffstat (limited to 'user_guide')
-rw-r--r-- | user_guide/changelog.html | 1 | ||||
-rw-r--r-- | user_guide/libraries/user_agent.html | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 09efc5434..a6332d64d 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -113,6 +113,7 @@ Hg Tag: </p> <li>Altered Form_Validation library to allow for method chaining on <kbd>set_rules()</kbd>, <kbd>set_message()</kbd> and <kbd>set_error_delimiters()</kbd> functions.</li> <li>Altered Email Library to allow for method chaining.</li> <li>Added <kbd>request_headers()</kbd>, <kbd>get_request_header()</kbd> and <kbd>is_ajax_request()</kbd> to the input class.</li> + <li>Altered <a href="libraries/user_agent.html">User agent library</a> so that <kbd>is_browser()</kbd>, <kbd>is_mobile()</kbd> and <kbd>is_robot()</kbd> can optionally check for a specific browser or mobile device.</li> </ul> </li> <li>Database 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.) <h2>$this->agent->is_browser()</h2> <p>Returns TRUE/FALSE (boolean) if the user agent is a known web browser.</p> +<code> if ($this->agent->is_browser('Safari'))<br /> +{<br /> + echo 'You are using Safari.';<br /> +}<br /> +else if ($this->agent->is_browser())<br /> +{<br /> + echo 'You are using a browser.';<br /> +}</code> + +<p class="important"><strong>Note:</strong> The string "Safari" in this example is an array key in the list of browser definitions. +You can find this list in <dfn>application/config/user_agents.php</dfn> if you want to add new browsers or change the stings.</p> + <h2>$this->agent->is_mobile()</h2> <p>Returns TRUE/FALSE (boolean) if the user agent is a known mobile device.</p> +<code> if ($this->agent->is_mobile('iphone'))<br /> +{<br /> + $this->load->view('iphone/home');<br /> +}<br /> +else if ($this->agent->is_mobile())<br /> +{<br /> + $this->load->view('mobile/home');<br /> +}<br/> +else<br /> +{<br /> + $this->load->view('web/home');<br /> +}</code> + <h2>$this->agent->is_robot()</h2> <p>Returns TRUE/FALSE (boolean) if the user agent is a known robot.</p> |