Re: Dynamic loading of javascript files into web pages



On Jun 28, 9:57 pm, Jorge <jo...@xxxxxxxxxxxxxxxxx> wrote:
One Dumm Hikk wrote:
On Jun 27, 9:39 am, Jorge <jo...@xxxxxxxxxxxxxxxxx> wrote:
On Jun 27, 10:42 am, Gregor Kofler <use...@xxxxxxxxxxxxxxxx> wrote:

(...)
As Jorge already mentioned:http://www.youtube.com/watch?v=52gL93S3usUandthe"degrading script
pattern" - it escapes me where the actual problem is, requesting such a
bizarre "solution".
The problem is:

- Given a script that has not been loaded yet (still loading), -
usually a dynamically inserted one-,
- Find the best way to have some piece of code run asap, immediatly
after the script (above) has loaded and executed.

(note that "onload" is not -usually- available on <script> tags in
most browsers)

That is trivial to do. Again, people try to make this stuff
harder than it has to be. Want a fool proof way to make a script
in an external file execute and know that is has loaded? Search
the archives, I have shown this MANY times and it was even before
many people knew JRs name.
At the end of the external file, place the call to the function
that you want executed.

Yes we do that in e.g. every JSONP response.

 > It will NOT get executed until the file

is loaded and it will get called only when the file gets loaded.
Stop making this harder than it has to be. Sheesh people.

That f() must be a global and requires a previous, separate <script>.
Resig's solution requires none of these.

Pure nonsense. It doesn't have to be global nor does it
"require a previous, seperate <script>".
f() can be a property of a single global object and the call
can be made in the same file that you are loading. I know that
to be true because its the way I have been doing it for many
years now. Download a .js file that has data in it with a
function call at the end of the file that deals with the
data in the file. That is how you deal with the issue of
knowing when/if the file is downloaded or not. It is
the ONLY *reliable* way to know that the data file has
downloaded.

Perhaps you should search the c.l.j archives for
"dynamic script insertion" and spend the next two
weeks or so reading the many many threads on this
topic.

On Jun 27, 10:30 am, Jorge <jo...@xxxxxxxxxxxxxxxxx> wrote:
On Jun 27, 3:49 am, One Dumm Hikk <hikksnotath...@xxxxxxx> wrote:
Dynamically loading script files to speed up the loading process?
Garbage.
What it will do, if done properly, is speed up the initial
rendering of the page. But it WON'T speed up load time of the
files and will actually slow it down. The reason it will
actually slow it down is because it has to do more work to
load the files. Whether the file is static coded or dynamically
loaded, the file still has to be downloaded from the server.
Want it to download faster? Make the file physically smaller.
Any other advice is magical hocus-pocus for making it load
faster if everything else is the same.
(...)
I'm not sure why do you say so, as it's obvious (isn't it ?) that
latency times add up when the scripts are loaded in series.

I say that because its patently true. Unless you want to try to
convince me that connection speed is determined by how the file
was attempted to be loaded. Again, take a HARD look at the original
script, how it was written, and how it would work. Then let's
discuss what it will or won't do.

<script>s hardcoded in the source .html halt parsing and download in
series, while dynamically inserted ones don't halt parsing and download
in parallel.

And that is precisely what I said. It doesn't change the download time
it
takes, it changes the rendering time to render an initial page so that
you fool the uneducated into thinking the page has finished "loading"
because they see content. Witness mySpace and its abominable use of
AJAX to try to "speed up" the site when in fact its a classic example
of the *wrong way* to speed up a site.

Has John Resig gotten any clue about JS in the last 18 months or so?
If he hasn't, then he still doesn't have a clue.

DM in disguise ?

That question, in and of itself, displays your level of knowledge
of what you are attempting to discuss. Try searching the archives
for the suggested search, read it all, and then get back to me.
Because as it stands now, your question shows that you have made
no effort to research the archives to find out about the subject
you are trying to portray yourself as an expert on.

I am not what I would consider an "expert" on the topic but I simply
have done a TON of research in the last 10 years or so on the topic
and a perusal of the archives would answer many of the questions you
are trying to - incorrectly - answer.

--
Randy Webb
.



Relevant Pages

  • Re: constant runtime errors-please help
    ... Common script errors messages can be eliminated by Clicking: ... click Internet Options. ... Two download versions are available for Windows Script 5.6. ... HiJackThis: - Free ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Dynamic loading of javascript files into web pages
    ... separate <script>) before calling it. ... But it WON'T speed up load time of the ... Want it to download faster? ... Try searching the archives ...
    (comp.lang.javascript)
  • Re: Idiot proof removal of junk?
    ... | I would like to send everyone a single script or small set of scripts ... | convince windows to boot into safe mode with command prompt. ... FireWall to allow it to download the needed AV vendor related files. ... This will bring up the initial menu of choices and should be executed in Normal Mode. ...
    (microsoft.public.windowsxp.help_and_support)
  • Announcement: Fix management tool for AIX 4.x/5.x available
    ... I'm pleased to announce a tool to automate download and management ... of ".bff" and ".rpm" fix packages for AIX ver. ... "fix-get.sh" script has been designed to automate fix packages ... discovery and download for servers with Unix AIX versions up to 5.3. ...
    (comp.unix.aix)
  • Re: Operations Masters
    ... Run diagnostics against your Active Directory domain. ... Run dcdiag, netdiag and repadmin in verbose mode. ... If you download a gui script I wrote it should be simple to set and run ...
    (microsoft.public.windows.server.active_directory)