There are cases where other 3rd party script are loaded
that *also* overload the window.onload-function.
In dynAPI should check that the window.onload-
function is 'free'.
in dynapi.js near line 99
--------------- replace this -----------------
f.onload = function() {
--------------- with this -----------------
// Befor setting the window.onload-function we must
check if it's not already in use (by some other 3rd party
script loaded).
// So we backup the function to call it.
var onloadBak = (typeof(f.onload)=='function') ?
f.onload : false;
f.onload = function() {
if (onloadBak) onloadBak();
modified dynapi.js is attached
modified dynapi.js
Logged In: YES
user_id=184788
very good point.. let's do that shall we?
Logged In: YES
user_id=706287
Hmm, do we stuff it before or after? I think it would be
good to have a flag so we can specify, just incase order is
pertinent. What if there's more than one function call
there already? I think it would be nice to have an array of
calls, one per entry, so we can have full control over
order, and then have the DynAPI onload step through that array.
Hmm, but how to achieve? A simple split on /;/ might work,
but might fail if it's data, like foo("some; strings; and;
stuff;"). I guess, as we parse through, we keep track of
parens (inside function call), and then only pay attention
to semi-colons outside function calls.
Hmm, anyways, that might be too advanced for right now, and
need to be revisited later. For now, maybe we'll just stick
it either before or after? Any preference as to a default
behavior?
One tweak I might suggest is to set onloadBak to the null
function instead of false, then we just call the Null
function instead of performing a conditional check. I might
attempt to gather empirical data by stuffing the case in a
loop and run it 500,000 times or so. :) Then it should be
evident if there's any advantage or not or browser-specific.
I think, before we add advanced new features (and bugs), we
need to get out of beta. :p New features like this are
motivation to get there! As always, ping this again if you
feel too much time has passed without a rsolution.