c#检查谷歌浏览器的扩展名 [英] c# check google chrome's extension

查看:143
本文介绍了c#检查谷歌浏览器的扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果用户使用chrome作为浏览器,我需要我的asp.net页面来检查google chrome扩展程序。



要么:

- 检查谷歌浏览器扩展程序,如果找不到,则显示消息。



或:

- 自动链接到谷歌网上商店并自动安装扩展程序。



我被困在这里

 System.Web.HttpBrowserCapabilities browser = Request.Browser; 
if (browser.Browser == chrome || browser.Browser == Chrome
{
this .Label1.Text = 你正在使用Google Chrome;
}

解决方案

ASP.NET与Chrome扩展无关,原因很简单:它是基于HTTP标准,没有这种扩展的概念。您对浏览器功能的请求基于标准化的HTTP标头(但Chrome或任何其他浏览器的标识很容易被任何其他浏览器模拟;这种技巧有时用于克服某些愚蠢网站的限制)。



我认为你试图向错误的方向前进。体面的Web应用程序应该在所有主要浏览器上运行,而不是关注扩展,而是恰恰相反:标准。



-SA

i need my asp.net page to check the google chrome extension if user is using chrome as their browser.

Either:
- Check google chrome extension, if not found, show message.

or:
- auto link to google web store and auto install the extension.

im stuck at here

System.Web.HttpBrowserCapabilities browser = Request.Browser;
           if (browser.Browser == "chrome" || browser.Browser == "Chrome")
           {
               this.Label1.Text = "You are using Google Chrome";
           }

解决方案

ASP.NET has nothing to do with Chrome extensions, by one simple reason: it's based on HTTP standards which has no notion of such extensions. Your request for browser capabilities is based on the standardized HTTP headers (but Chrome or any other browser's identity can easily mocked by any other browser; such trick is sometimes used to overcome limitation of some stupid Web sites).

I think you are trying to move in wrong direction. Decent Web application should run on all of major browser's and be focused not on "extensions", but just the opposite: on standards.

—SA


这篇关于c#检查谷歌浏览器的扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆