使用特定的URL地址从Java code关闭浏览器 [英] Close browser from java code using specific url address
问题描述
1)我想用URL地址从我的Java code关闭特定的浏览器选项卡。因为它是一个客户端服务器应用程序了。我想用URL地址从我的客户端应用程序关闭浏览器标签页
1) I want to close specific browser tab using url address from my java code. As it is a client server applicaiton. I want to close browser tab using url address from my client application
在服务器端将有一个罐子,将与客户端请求沟通,并采取从客户端的URL并关闭浏览器根据URL地址在服务器计算机上运行。
The server side will have a jar that will communicate with client request and take the url from client and close the browser running in the server machine according the url address.
2)我想从我的Java code闭上我的Firefox或Chrome浏览器也。我不想杀进程,但正常关闭浏览器。
2) I want to close my firefox or chrome browser from my java code also. I don't want to kill process but shut down browser normally.
**我需要这个解决方案的Ubuntu操作系统。
**I need this solution for ubuntu os.
希望对你的回应。
推荐答案
您必须调用JavaScript从您的Java类code关闭客户端的浏览器。
这被称为逆向Ajax的。您可以通过使用DWR框架实现的。
这是一个功能强大的API,帮助您从javascipt的,反之亦然调用Java。
You have to call a javascript to close the client's browser from your javascode. This is called reverse Ajax. You can achieve by using DWR framework. This a powerful API which help you to call Java from Javascipt and vice versa.
通过使用这种可以筛选客户端浏览器是到指定的网址。
By using this you can filter clients browser that are onto a specific URL.
和这个解决方案不是一个特定的操作系统它会正常工作,每OS平台。
And this solution is not a OS specific it will work fine for every OS platform.
这篇关于使用特定的URL地址从Java code关闭浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!