新窗口中的javascript window.location [英] javascript window.location in new tab

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

问题描述

我通过 window.location 转移用户到某个网址,但是此网址在浏览器的同一个标签中打开。我希望它在新标签中打开。我可以使用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天全站免登陆