Forum OpenACS Development: Re: Suggestion for xowiki javascript includes

Collapse
Posted by Gustaf Neumann on
hmm, i would not recommend to use IE's conditional comments, and i am reluctant to provide e.g. user-agent based browser detection (which is not recommended in general, feature detection from js is better).

In your case, i would recommend to detect IE from JavaScript and load additional files conditionally from js. Since you use apparently YUI, the following links might be a starter

http://developer.yahoo.com/yui/yuiloader/
http://www.nczonline.net/blog/2009/07/28/the-best-way-to-load-external-javascript/
http://www.slideshare.net/caridy/yui-3-loading-strategies

Collapse
Posted by Richard Hamilton on
Gustaf,

Thank you. Yes on reflection I think you are right. I was experimenting with a general purpose js module that claimed to make IE5.5, IE6 and IE7 fully W3C compliant. It seemed to me that something like this might have had general applicability for openacs and xowiki. However, testing established that it doesn't work properly anyway! 😊

The server side user agent detection option would certainly seem to be a more robust route to take for simple tcl pages, however I am not clear how I might go about arranging for xowiki to do this. I presume multiple versions of each page would be required which may not be ideal.

I will do as you suggest and load a script that modifies my stylesheet after it is loaded for each of the older non-compliant browsers.

As an aside, if one wanted to provide a stylesheet for different user agents (i.e. cellphone, braille machine or some other device) from xowiki, how would this be done?

Regards
Richard

Collapse
Posted by Richard Hamilton on
Actually, this raises an interesting question with respect to the IE specific conditional comments and whether or not they are a good idea. (I'm sorry that this has drifted a bit off-topic).

Browser detection won't work. Feature detection is better, and the abstractions in YUI and other libraries pretty much do most of the work for you.

However, where your requirements are restricted to the need to supply minor CSS modifications that are absolutely specific to IE6 (for example to cope with the incorrect implementation of the block width calculations, or the lack of a child selector), is it better to start poking around in the DOM of ALL browsers to establish the reported block width for a single element (or the property value you set with the child selector), or better to use the conditional comments that Microsoft has provided for the purpose to insert changes only with IE6?