[Dojo-interest] IsBrowserSupported method?

Rob Kinyon rob.kinyon at gmail.com
Sat Dec 9 17:14:43 MST 2006

On 12/9/06, Alex Russell <alex at dojotoolkit.org> wrote:
> On Friday 08 December 2006 3:57 pm, Bartley Hazer wrote:
> > Is there any method in any utility class that will tell you if the
> > user's current browser is supported?
> You need to define "supported". Some features work on some browsers
> whereas others degrade to fallback states, and on some browsers Dojo
> won't even boostrap, making such a method nearly useless. We'd need to
> maintain a feature matrix to accurately answer the question that I
> think you are asking.

I think that the Best is rearing its ugly head here. I'd break this
down a few ways:

    1) Widgets should be able to declare what their minimum
requirements are. For example, if a widget is known to not work on
IE5.5 for whatever reason, then it should be able to state that
information. This is no different that what Java, Perl, Ruby, and a
number of other languages provide. Except, instead of just language
features, we're also determining whether the environment is suitable.
    2) Client code should be able to determine if a given
dojo.foo.bar() method will work as expected. So, dojo.willWork(
'foo.bar' ) or dojo.foo.willWork( 'bar' ) would certainly be helpful.
    3) On any browser that is running javascript, a simple "dojo = {
notWorking: true };" will always load. Then, the bootstrapping process
can overwrite that once it's done with its business. So, client code
would now be able to depend on "if ( dojo.notWorking ) alert(
"Uh-oh..." );"

    In all cases, the answer should default to false and let the code
that is being loaded set itself to true. So, it's more of a registry
of loaded items plus each item is able to state to the loader "I will
only work if the following items are true: A, B, and C."

    This will have flaws in it, as all solutions do. But, I think that
something like this would go a long way to solving 80% of the problems
with determining compat in a simpler way. And, this method would give
users some pretty heavy-duty future-proofing.


More information about the Dojo-interest mailing list