简体   繁体   English

如何在Chrome浏览器中禁用Web应用程序

[英]How to disable web application in chrome browser

Can you please give me any idea or an example, how to disable the access of a web application in chrome browser. 您能否给我任何想法或示例,如何禁用chrome浏览器中的Web应用程序访问。

In my project I am using spring + hibernate. 在我的项目中,我正在使用spring + hibernate。 Because of some design issue design is not coming properly in chrome browser but in Mozilla it is coming properly. 由于某些设计问题,Chrome浏览器中的设计无法正常进行,但Mozilla中的设计却可以正常进行。

So I want to this through programmatically and stop accessing application in chrome browser. 所以我想通过编程来做到这一点,并停止在chrome浏览器中访问应用程序。

Thanks in advance. 提前致谢。

following is the UA string for latest chrome, you can simply check for it on the server side ( preferable ) or client side and remove the application from web page when required. 以下是最新chrome的UA字符串,您可以在服务器端(最好是)或客户端端简单地对其进行检查,并在需要时从网页中删除该应用程序。

Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36

for JS use navigator.userAgent to check the user agent against and remove the element 对于JS,请使用navigator.userAgent检查用户代理并删除该元素

reference : http://www.useragentstring.com/pages/Chrome/ 参考: http : //www.useragentstring.com/pages/Chrome/

Using javaScript navigator object we can identify client browser. 使用javaScript导航器对象,我们可以识别客户端浏览器。 This navigator object will display the String as below: 该导航器对象将显示String,如下所示:

 Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36

now you have to check this String contains "Chrome" or not to identify client using chrome or not. 现在您必须检查此字符串是否包含“ Chrome”,以标识是否使用chrome客户端。

for exp: 对于exp:

var str=navigator.userAgent;
if(str.indexof('Chrome')>0){
 // true
}else{

 }

一种想法是通过检查用户代理是否来自chrome,添加过滤器以阻止chrome浏览器或将其重定向到错误页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM