Initial convert example to js
fix https browser, add tests