Replace startsWith function with indexOf. It was causing javaScript error in Chrome