-
Book Overview & Buying
-
Table Of Contents
Mastering Joomla! 1.5 Extension and Framework Development Second Edition
By :
A useful source of information about the client is the browser. We can use the JBrowser class, located in joomla.environment.browser, to investigate the client browser.
Browsers have features that enable them to behave in certain ways. For example, a browser may or may not support JavaScript. We can use the hasFeature() method to check for different features.
T his example checks for JavaScript support:
$browser =& JBrowser::getInstance();
if ($browser->hasFeature('javascript'))
{
// the browser has JavaScript capabilities
}This is a list of the different features we can check for when using the hasFeature() method:
accesskey
cite
dom
frames
dhtml
homepage
html
iframes
images
java
javascript
optgroup
rte
tables
utf
wml
xmlhttpreq
Browsers also have quirks (peculiarities of behavior). We can use JBrowser to check for certain quirks in browsers. In this example, we check that the browser is adequately able to deal with pop ups:
$browser =& JBrowser::getInstance(); if ($browser->hasQuirk...
Change the font size
Change margin width
Change background colour