update way.js to be cross-browser