---
title: "js 判断 字符串包含某字符串"
author: "endual"
date: "2013-04-01T15:48:23Z"
tags: []
categories: ["Web前端"]
slug: "js"
draft: false
lastmod: "2013-04-01T15:48:23Z"
id: 1840151
url: "https://endual.iteye.com/blog/1840151"
---

1. function getType(){
2. if(navigator.userAgent.indexOf("iPhone") != -1) {
3. alert("我是iPhone~！");
4. }
5. if(navigator.userAgent.indexOf("iPad") != -1){
6. alert("我是iPad~！");      }
7. }