Open magnet link without losing focus

旧街凉风 提交于 2019-12-14 01:48:19

问题


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.


回答1:


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')



回答2:


another solution by using chrome API.

chrome.tabs.update({url: magnet_uri});



来源:https://stackoverflow.com/questions/23831396/open-magnet-link-without-losing-focus

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!