Changed method for ascertaining width for improved compatibility with non-standard js callers, defered/async script call in example