Corrected access to JS code to be compatible with Chrome