make js more cross-browser compatible