I have this function
function getSwf(appName) {
if (navigator.appName.indexOf("Microsoft") != -1)
return window[appName];
return document[appName];
}
But not sure if the last 2 lines are correct. I mean,
return window[appName];
return document[appName];
or
return document[appName];
return window[appName];
If you’re trying to find a global variable, it’s always on
window.If you’re trying to find an HTML element with an
id, on most browsers, it’s always onwindow, but that behavior isn’t (yet) the subject of an active specification; to be really sure, usedocument.getElementById(appName)instead, which will work on all browsers. (Firefox, for instance, doesn’t put elements withids onwindow.)IE will also tend to throw elements with
names onwindow, even thoughnamevalues aren’t required to be unique. sigh Other browsers, thankfully, don’t.