Replace 'global' by 'window' in JS code.