新选项卡中的 javascript window.location [英] javascript window.location in new tab

查看:22
本文介绍了新选项卡中的 javascript window.location的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过 window.location 将用户转移到某个 url,但此 url 在浏览器的同一选项卡中打开.我希望它在新选项卡中打开.我可以用 window.location 这样做吗?还有其他方法可以执行此操作吗?

I am diverting user to some url through window.location but this url opens in the same tab in browser. I want it to be open in new tab. Can I do so with window.location? Is there another way to do this action?

推荐答案

我认为没有办法做到这一点,除非您正在编写浏览器扩展.您可以尝试使用 window.open 并希望用户将浏览器设置为在新选项卡中打开新窗口.

I don't think there's a way to do this, unless you're writing a browser extension. You could try using window.open and hoping that the user has their browser set to open new windows in new tabs.

这篇关于新选项卡中的 javascript window.location的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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