<?xml version="1.0" encoding="utf-8"?>

<snippet name = "平台检测" description = "用于区分 Macintosh 和 Windows 浏览器的简单代码。" preview="code" type="block">

<insertText location="beforeSelection">

<![CDATA[function platformDetect()

{

  if(navigator.appVersion.indexOf("Win") != -1)

  {

    alert("Windows");

  }

  else if(navigator.appVersion.indexOf("Mac") != -1)

  {

    alert("Macintosh");

  }

  else alert("Other");

}

]]>

</insertText>

<insertText location="afterSelection"><![CDATA[]]>

</insertText>

</snippet>

