是否可以从网站检查移动设备上是否存在应用程序?
目前我正在使用C#开发一个网站,该网站必须能够选择是否打开相关应用程序或安装它。
答案 0 :(得分:1)
(我在这里假设ASP.NET,因为你没有指定。)
是的,如果平板电脑发送了正确的用户代理字符串,则可以。
我已附加了当前的platform.browser文件,但这可能有不准确之处。内容放在App_Browsers
ASP.NET文件夹中。补丁文件的原因是微软并不总是最新的,并且有一些缺失的信息。
Android是一个问题,但v3只是平板电脑4可能不是,我没有时间进一步纠正这个问题。
要使用Request.Browser.Platform
和Request.Browser.Version
<browsers>
<gateway id="PlatformWindowsPhone" parentID="Platform">
<identification>
<userAgent match="Windows Phone" />
</identification>
<capabilities>
<capability name="platform" value="Windows Phone" />
</capabilities>
</gateway>
<gateway id="PlatformIE11" parentID="PlatformWinnt">
<identification>
<userAgent match="Trident/7.0" />
<userAgent match="rv:11.0" />
</identification>
<capabilities>
<capability name="browser" value="IE" />
<capability name="version" value="11.0" />
</capabilities>
</gateway>
<gateway id="PlatformiPad" parentID="Platform">
<identification>
<userAgent match="iPad" />
</identification>
<capabilities>
<capability name="platform" value="iPad" />
</capabilities>
</gateway>
<gateway id="PlatformiPhone" parentID="Platform">
<identification>
<userAgent match="iPhone" />
</identification>
<capabilities>
<capability name="platform" value="iPhone" />
</capabilities>
</gateway>
<gateway id="PlatformAndroid" parentID="Platform">
<identification>
<userAgent match="Android" />
</identification>
<capabilities>
<capability name="platform" value="Android" />
</capabilities>
</gateway>
<gateway id="PlatformAndroid50" parentID="Platform">
<identification>
<userAgent match="Android 5\.0" />
</identification>
<capabilities>
<capability name="version" value="5.0" />
</capabilities>
</gateway>
<gateway id="PlatformAndroid45" parentID="Platform">
<identification>
<userAgent match="Android 4\.5" />
</identification>
<capabilities>
<capability name="version" value="4.5" />
</capabilities>
</gateway>
<gateway id="PlatformAndroid44" parentID="Platform">
<identification>
<userAgent match="Android 4\.4" />
</identification>
<capabilities>
<capability name="version" value="4.4" />
</capabilities>
</gateway>
<gateway id="PlatformAndroid43" parentID="Platform">
<identification>
<userAgent match="Android 4\.3" />
</identification>
<capabilities>
<capability name="version" value="4.3" />
</capabilities>
</gateway>
<gateway id="PlatformAndroid42" parentID="Platform">
<identification>
<userAgent match="Android 4\.2" />
</identification>
<capabilities>
<capability name="version" value="4.2" />
</capabilities>
</gateway>
<gateway id="PlatformAndroid41" parentID="Platform">
<identification>
<userAgent match="Android 4\.1" />
</identification>
<capabilities>
<capability name="version" value="4.1" />
</capabilities>
</gateway>
<gateway id="PlatformAndroid40" parentID="Platform">
<identification>
<userAgent match="Android 4\.0" />
</identification>
<capabilities>
<capability name="version" value="4.0" />
</capabilities>
</gateway>
<gateway id="PlatformAndroid30" parentID="Platform">
<identification>
<userAgent match="Android 3\.0" />
</identification>
<capabilities>
<capability name="version" value="3.0" />
</capabilities>
</gateway>
<gateway id="PlatformAndroid23" parentID="Platform">
<identification>
<userAgent match="Android 2\.3" />
</identification>
<capabilities>
<capability name="version" value="2.3.3" />
</capabilities>
</gateway>
<gateway id="PlatformAndroid22" parentID="Platform">
<identification>
<userAgent match="Android 2\.2" />
</identification>
<capabilities>
<capability name="version" value="2.2" />
</capabilities>
</gateway>
<gateway id="PlatformWinMacOs" parentID="Platform">
<identification>
<userAgent match="Macintosh" />
</identification>
<capabilities>
<capability name="platform" value="Mac OS" />
</capabilities>
</gateway>
<gateway id="PlatformWinXP" parentID="PlatformWinnt">
<identification>
<userAgent match="Windows NT 5\.1" />
</identification>
<capabilities>
<capability name="platform" value="Windows XP" />
</capabilities>
</gateway>
<gateway id="PlatformWin2003" parentID="PlatformWinnt">
<identification>
<userAgent match="Windows NT 5\.2" />
</identification>
<capabilities>
<capability name="platform" value="Windows 2003" />
</capabilities>
</gateway>
<gateway id="PlatformWinVista" parentID="PlatformWinnt">
<identification>
<userAgent match="Windows NT 6\.0" />
</identification>
<capabilities>
<capability name="platform" value="Vista" />
</capabilities>
</gateway>
<gateway id="PlatformWin7" parentID="PlatformWinnt">
<identification>
<userAgent match="Windows NT 6\.1" />
</identification>
<capabilities>
<capability name="platform" value="Windows 7" />
</capabilities>
</gateway>
<gateway id="PlatformWin8" parentID="PlatformWinnt">
<identification>
<userAgent match="Windows NT 6\.2" />
</identification>
<capabilities>
<capability name="platform" value="Windows 8" />
</capabilities>
</gateway>
<gateway id="PlatformWin81" parentID="PlatformWinnt">
<identification>
<userAgent match="Windows NT 6\.3" />
</identification>
<capabilities>
<capability name="platform" value="Windows 8.1" />
</capabilities>
</gateway>
</browsers>
(我已将其发布为社区维基,因此可以改进信息)
答案 1 :(得分:1)
简短的回答是&#34;不,您无法检查用户在平板电脑上安装的内容。&#34;
但是,您可以使用代理嗅探来提供不同的链接,如果您的应用注册了自定义URL方案,那么您可以拥有一个可以直接打开应用的链接。在您的网站上,该链接可能指向:YourApp://something
。您至少可以选择让人们从网站上启动应用程序(尽管无法确定是否安装了应用程序)。
这是你能做的最好的,这是设计的。如果允许网站查看我们设备上的内容,那将会非常混乱。
编辑:iOS,Android和Windows Phone 8支持此功能。
EDIT2:此外,YourApp://something
的链接(至少在Windows Phone上,这是我所有的方便,但我也怀疑在iOS和Android上)提示用户安装应用程序,如果他们还没有。