Open kevin-hiq opened 9 years ago
just installed it, and this is the first error i have as well.
Could you provide a piece of code?
found that this is due to the body not being initialised yet as code is placed in head. Might be worth putting a document.readyStateChange before the code is run.
As a test i replaced line: 189
document.onreadystatechange = function () {
if (document.readyState == "complete") {
document.body.appendChild(sb);
}
}
which works as it waits for the body to be available before adding the element.
Other way is to put smartbanner initialization right after body close tag
yes, i can place the code at the bottom, which i might choose to do so, but the example you have on install is then incorrect. so by taking your example the code fails without a catch for the the document to load.
I faced this issue too
right now README contains relevant example. prob this issue should be closed
I get the error : Uncaught TypeError: Cannot read property 'appendChild' of null
Smartbanner.js line: 189 "document.body.appendChild(sb);"
But "sb" does get declared a few lines higher up "var sb = document.createElement('div');"
Any idea what might be the issue?