views:

56

answers:

1

how can i write a conditional comment for scripts that should run for all browsers except IE 8 and below?

i saw Conditional comment for 'Except IE8' ?

but how do i adapt it to include scripts files not inline scripts?

+1  A: 

The trick explained there would work just as well for external scripts — set a "this browser is old" flag in a conditional-commented inline script, and have your external scripts check for that flag.

If you mean to conditionally include entire script files, your best bet would probably be a script that browser-sniffs and dynamically includes the appropriate files. Otherwise, you could use downlevel-revealed conditional comments (thanks, bobince!).

Chuck
Downlevel-revealed conditional comments are fine using the [valid syntax](http://stackoverflow.com/questions/1636282/hiding-html-portion-from-several-browsers-conditional-comments/1636365#1636365). It's a shame MS continue to promote the needlessly-invalid version.
bobince
@bobince: Thanks for that. I *thought* there was a valid syntax along those lines, but a search on MSDN convinced me I was remembering wrong. That is a shame.
Chuck