打开磁铁链接而不会失去焦点 [英] Open magnet link without losing focus

查看:95
本文介绍了打开磁铁链接而不会失去焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

javascript(或其他)中是否有办法处理磁力链接而浏览器不会失去焦点?这有点像在背景中打开一个标签而不离开当前页面。

Is there a way in javascript (or other) to handle a magnet link without the browser losing the focus? It'd be a little like opening a tab in the background without leaving the current page.

推荐答案

我最近遇到了类似的问题,并能够通过在页面上创建一个命名框架并将其用作 window.open 的目标来解决它:

I recently had a similar problem, and was able to solve it by creating a named frame on the page and using it as the target for window.open:

<iframe style="display:none" name="magnetframe"></iframe>

window.open(magnet_uri, 'magnetframe')

这篇关于打开磁铁链接而不会失去焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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