O'Reilly logo

Mastering Joomla! 1.5 Extension and Framework Development by Chuck Lanham, James Kennard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The browser

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required