javascript better process (browser-side compatible)