This is working, however my strict QA say there can be no console errors.
I’ve writing an iframe to the DOM, and setting up a .onload event;
var configureSDK = function () {
alert('lets configure');
}
var init = function (config) {
// pass configurables to global var
settings = config;
setupSDK(document);
function setupSDK(d) {
// setup iframe
sdkportal = d.createElement('IFRAME');
sdkportal.setAttribute('src', '//www.webtekkers.com');
sdkportal.setAttribute('width', '100%');
d.body.appendChild(sdkportal);
sdkportal.onload(configureSDK());
}
}
Like I said it works, BUT Chrome is showing;
Uncaught TypeError: Property ‘onload’ of object # is not a function
Now I know, I should really be setting up individual events AddEventListener|attachEvent(‘load|onload’) for the different browsers, but that’s more work.
Is this just Chrome being WRONG or am I?
Please no jQuery alternatives
Thanks Will
The error message, although hard to understand, is exactly right.
onloadis a property, and its value isundefineduntil you assign something to it. Usually it will be assigned a reference to a function.You probably mean to set the
onloadproperty to theconfigureSDK()function reference:Or as a function call (if you had more work to do in the
onlaod):