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
Release: 2016-05-16 16:54:21
Original
1898 people have browsed it

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.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template