YUI recommends YUI3.
YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.
This documentation is no longer maintained.
This example demonstrates the use of
Drag over the select
Drag over the select
Browser sniffing is an imprecise science, and relies on many things in the browser environment to be just right. Though many techniques are very accurate, 100% accuracy can't be guaranteed.
YAHOO.env.ua object to inform you of what browser your page is being viewed in, but for your own sake, do not infer anything from this.
YAHOO.env.ua is an object literal containing keys for most major user agents. The key corresponding to the current browser is assigned a version number. All others have value 0.
There's more information on the
YAHOO.env.ua object and value ranges in the API Documentation.
YAHOO.env comes bundled with the YAHOO Global Object and is used to keep track of what is known about the YUI library and the browsing environment.
If you are using any other YUI component on your page, you should already have YAHOO.env available. Otherwise, add the following:
In this example, we'll add an iframe shim to a Drag and Drop element to account for a known display bug in Internet Explorer 6 regarding the z-indexing of
select elements. For you folks out there not using IE6, here's a screen shot of the bug in action.
In this case, there is no way other than browser sniffing or conditional comments to address IE's rendering bug. We'll choose sniffing over using proprietary extensions.
Here's the markup for the example:
Here, we create two Drag and Drop elements, then add the shim to the
dd2 element if the page is being viewed in a vulnerable version of IE. Normally, of course, you'd add the shim behavior to both, but this will allow us to compare results.
Note: Logging and debugging is currently turned off for this example.
All YUI 2.x users should review the YUI 2.8.2 security bulletin, which discusses a vulnerability present in YUI 2.4.0-2.8.1.
Copyright © 2013 Yahoo! Inc. All rights reserved.