Loving this module. Finally, a module that lets people know about upgrading in a non-insulting way.
But, the code in the module could use some clean-up. Calling js via a page callback is ugly. The display is not themable or translatable. The attached patch reworks the module providing a css file (so themers can alter the look), a js file using Drupal.theme (so themers can change the html markup) and Drupal.t (so it can be translated).
Ideally, Something like this would be committed, then the translations already provided could be entered, then a release could be made that's already multi lingual.
Comments
Comment #1
mfer commentedoops, here is a patch that puts the $Id$ at the top of the two new files.
Comment #2
q0rban commentedsubscribe
Comment #3
geerlingguy commentedSubscribe.
Comment #4
jonathan_hunt commentedThanks @mfer. I've added your CSS and generated the markup via a theme() function. I'd like to be able define the markup once, rather than having it in two places (module and js). The original IE6 no more banner code is designed to be placed directly in the page, so it would be good to have a non-js option. Ideas welcome.
Comment #5
mfer commentedHaving the js be a drupal callback is a terrible idea. Normally, when a js file is loaded the webserver gets it from the file system and delivers it. This is fairly fast. The setup here where the js is defined as a menu callback means that the webserver calls back to Drupal, Drupal does a complete bootstrap, and then Drupal generates the js. Even with agressive caching (not available to authenticated users) this is much much much slower and much more resource intensive.
In general it's a bad idea.
Is there a reason for providing the theme variable? A theme would have to specifically take advantage of it. For a module like this it would be rare for a contributed theme to take advantage of it.
In any case, because this module causes Drupal to do two complete bootstraps for every page load (really really bad for performance, server resources, and the environment) I can't use it in it's current state.
Comment #6
jonathan_hunt commentedWhy wouldn't the browser cache the js after the first request?
Comment #7
mfer commented@jonathan_hunt with that you make the assumption that it's returning visitors who will see the cached page. All new visitors have to do the double duty. So, for sites that have pageviews that are primarily new people browser caching isn't going to do any good.
A good example of this case is a technical blog. The most common way people go there is because they searched for something and found a post on it. The page will have a high bounce rate because the person looked for a topic. JavaScript caching does no good here.
For many sites JavaScript caching may help the 'regulars'. But, the regulars aren't the 80% that only do one page view on the site.
Comment #8
bleen commentedsubscribe
Comment #9
gooddesignusa commentedsubscribe
Comment #10
bibo commented(subscribe).
FYI l'm using this module simply because it looks neat, and offers good browser variants instead of just newer IE versions, unlike http://drupal.org/project/ie6update.
My 2 cents:
I totally agree. Except that in this case the additional pageload is not really affecting users other than the IE6-masochists (since the script load is in the conditional statement), and thus has no effect for "normal" users. Still, it's wasting server resources.
Seriously? This callback is just .. uhm.. not cool. Even if the performance impact is relativily limited, performance should always be prioritized, when possible.
The 2 minutes that it would take to change the code to point the JS to a normal file to avoid completely useless bootstrapping - would definitely be time well spent.
On an unrelated note (I'm too lazy to open another issue), I noticed a minor bug in this code:
To be more specific:
$vars['scripts'] .= '<script type="text/javascript" src="/ie6nomore.js"></script>';The "/" in
src="/ie6nomore.js"should be replaced by base_path(). Otherwise this whole thing wont work if Drupal was installed in a subdirectory (instead of apache document root).Also, instead of using
ie6nomore_preprocess_page(), the conditional script could also be set via drupal_set_html_head() ( http://api.drupal.org/api/function/drupal_set_html_head/6 ). I guess the current version works fine, but this might have some impact on the theme used.I don't want to sound like a smartass, but I think adding the JS in this way would work better:
I haven't even tested this code, but it should work in any normal theme, subdirectory install or not and without unnecessary bootstrapping. The JS would still not get aggregated, since it would require drupal_add_js(), and also serverside client recognizition (not really an issue, but not necessary either).
... (oh and
$vars['ie6nomore'] = '<!--[if lt IE 7]>'. theme('ie6nomore_banner') .'<![endif]-->'), would still belong in the preprocess-function.Comment #11
jonathan_hunt commentedThanks. Per @mfer the menu callback has been abandoned and js is now injected via hook_init() (refer alpha3 release).