@Nathan Nobbe: I do not want to simply write <script> tag because like Justin Perkins explain during the loading of the page when the browser see a <script> tag it execute it. So if the server hang, the page slow down...
Scriptaculous use a handy way to write <script> tag. But it did it - In the <head> or where it is declared - Immediatly not onload @Justin Perkins: Thanks i'm going to try that. It is close to what I already tried. If I remember the script loads but replace the full page. It's a little bit weird. I will try to send my question to MyBLogLog team. May be they already know this issue. Thanks On Jan 28, 2008 4:14 AM, Nathan Nobbe <[EMAIL PROTECTED]> wrote: > > On Jan 27, 2008 10:02 PM, Justin Perkins <[EMAIL PROTECTED]> wrote: > > > > > > > > On Jan 27, 2008 7:09 PM, Nathan Nobbe <[EMAIL PROTECTED]> wrote: > > > im not sure why you want to retrieve the remote script once the page has > > > loaded. > > > > It's actually a very nice way to include external scripts, since the > > loading of a script (with src) has an effect on page load times, which > > impacts tasks that run on page load and also visible to the user by > > way of the browser's progress indicator. > > > > You can create script nodes on the fly, with normal DOM-node creating > > code and it works well in Firefox and IE6/7. I have not tested other > > browsers. > > > > This is the basic idea: http://pastie.textmate.org/144194 > > > > Note that the first thing that code does is look for a script include > > already on the page that has included the same script, and if it is > > found, then it is removed. This may be overkill, but is done to > > prevent caching problems. If the same function that includes the > > script is called multiple times, and you're expecting the script to be > > refreshed, then you may want to append some type of no-cache parameter > > (a time stamp) onto the URL, such as: > > > > // do this just before the call to setAttribute('src', src) > > src = ( src.match( /\?/ ) ? src + '&' : src + '?' ) + ( nocache ? > > 'nocache=' + new Date().getTime() + '&' : '' ); > > > > This little snippet has worked out very well for me, especially when > > requesting external scripts that may take a while to load. > > > > Have a great night. > > if you want a good model for dynamically loading scripts via ajax with the > protoype framework, take a look at scriptacuolus.js, they have the exact > mechanism you are looking for in place already. > also, per the construction of dom nodes dynamically, take a look at > builder.js > also bundled in the scriptaculous library. > > -nathan > > > > > > -- Jean-Philippe Encausse - Veille / R&D Jalios SA Jp [at] encausse.net - http://www.encausse.com - http://www.jalias.com GTalk: jp.encausse [at] gmail.com - SMS: sms [at] jp.encausse.net Mob: +33 6 82 12 56 99 - Job: +33 1 39 23 92 83 - Tel: +33 1 39 18 90 15 Do it Once, Use it Twice ~ Do it Twice, Make It Once --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
