简体   繁体   English

在其他浏览器中打开链接

[英]Opening a link in a different browser

I'm trying to find a way to take a link from one browser and open it in another browser. 我正在尝试找到一种方法来从一个浏览器获取链接并在另一个浏览器中打开它。 This could be taking a link from a Firefox tab and opening it in Chrome, or taking a link in a Chrome Incognito window and opening it in a non-incognito Chrome window. 这可能是从Firefox标签获取链接并在Chrome中打开它,或者是在Chrome隐身窗口中获取一个链接并在非隐身Chrome窗口中打开它。

Here's some more detail. 这里有更多细节。 I have a webpage that refreshes every second, and uses javascript(via Greasemonkey/Tampermonkey) to search for certain keywords. 我有一个网页,每秒刷新一次,并使用javascript(通过Greasemonkey / Tampermonkey)搜索某些关键字。 When a keyword in my list matches one associated with a link on the page, it automatically opens that link in a new tab. 当列表中的关键字与页面上的链接相关联时,它会自动在新标签页中打开该链接。 If it's possible, I need to take those links to a different browser somehow, automatically. 如果可能,我需要以某种方式自动将这些链接链接到其他浏览器。

AFAIK, something like this isn't possible with javascript due to security issues. AFAIK,由于安全性问题,javascript无法使用这种方法。 The only two solutions I can think of are: 我能想到的仅有的两种解决方案是:

1: Using AutoHotKey to make a macro to copy the link, alt-tab, and paste into the other program. 1:使用AutoHotKey制作宏以复制链接,alt-tab并粘贴到其他程序中。 This is manual, I want something automatic. 这是手动的,我想要自动的。 EDIT: I realized I can use AHK to monitor a page, but I don't know if it could be done without introducing more latency than I would like. 编辑:我意识到我可以使用AHK来监视页面,但是我不知道如果不引入比我想要的更多的延迟就可以做到这一点。 Keeping the total time from the webpage refreshing to opening the link as low as possible is the most important thing. 最重要的是使从刷新网页到打开链接的总时间尽可能地短。

2: Having some other program handle it for me. 2:让其他程序为我处理。 I'm not aware of any and wonder how difficult/costly it would be to roll my own or have someone make one. 我一无所知,不知道自己动手或有人做一个人会多么困难/代价高昂。 I'm not even sure if I could interface it with my current script. 我什至不确定是否可以将其与当前脚本连接。

I'm fairly certain it would be possible with number 2, although I don't know about cost or difficulty... could there be another way to accomplish this? 我很确定第二个数字是可能的,尽管我不知道成本或难度……还有另一种方法可以做到这一点吗?

For reference, this is the relevant section of code that I'm currently working with. 作为参考,这是我目前正在使用的代码的相关部分。 It opens any link which matches a list of keywords in a new tab. 它会在新标签页中打开与关键字列表匹配的所有链接。 These are the links I'm trying to figure out a way to open in a different browser. 这些是我试图找出在其他浏览器中打开的方式的链接。 It uses dynamic object names and a dynamic URL, but essentially this is just saying if the checkboxes are checked and a link matches my autoOpenList(keyword list), then open the link in a new tab. 它使用动态对象名称和动态URL,但实际上这只是在说是否选中了复选框且链接与我的autoOpenList(关键字列表)匹配,然后在新选项卡中打开链接。

if(jQuery.inArray(autoOpenTemp,autoOpenList) != -1  && window['autoAccept' + autoOpenTemp].checked && autoAccept_input.checked ){
    var tempURL = LINK_BASE+obj.acc_link;
    window.open(tempURL, '_blank');
}
  1. Use Java's HttpServlet Class to create a web application. 使用Java的HttpServlet类创建一个Web应用程序。 You can setup the server by Tomcat. 您可以通过Tomcat设置服务器。 Servlets Quick Guide . Servlet快速指南
  2. Start CLI by Java and open browser through CLI. 通过Java启动CLI,然后通过CLI打开浏览器。
  3. Call the web application by url on your page. 通过页面上的url调用Web应用程序

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

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