Home >Web Front-end >JS Tutorial >How to judge chrome browser using javascript_javascript skills

How to judge chrome browser using javascript_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:54:211929browse

Use userAgent to determine whether the string returned by userAgent contains "Chrome". The specific detection is done through the indexOf method.

Copy code The code is as follows:


About indexOf method:

The indexOf method returns an integer value indicating the starting position of the substring within the String object. That is, the position of the characters contained in the brackets of indexOf() in the string is returned, and counting starts from 0. If there are repeated characters, the first character shall prevail. If the substring is not found, -1 is returned.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn